class
Matter::MDNS::MulticastSocket
- Matter::MDNS::MulticastSocket
- Reference
- Object
Overview
MulticastSocket for mDNS communication
Provides UDP multicast I/O on port 5353 for mDNS (Multicast DNS). Supports both IPv4 (224.0.0.251) and IPv6 (ff02::fb) multicast groups.
RFC 6762 §5.1: Multicast DNS uses port 5353 on both IPv4 and IPv6
Defined in:
matter/mdns/multicast_socket.crConstant Summary
-
Log =
::Log.for("matter.mdns.socket") -
MDNS_IPV4_MULTICAST_ADDRESS =
"224.0.0.251" -
mDNS multicast addresses
-
MDNS_IPV6_MULTICAST_ADDRESS =
"ff02::fb" -
MDNS_PORT =
5353_u16 -
MULTICAST_TTL =
255 -
TTL for multicast packets (RFC 6762 §11: SHOULD be 255)
Constructors
Instance Method Summary
-
#close : Nil
Close the socket and leave all multicast groups
-
#closed? : Bool
Check if socket is closed
- #family : Socket::Family
- #family=(family : Socket::Family)
-
#join_multicast_group : Nil
Join the mDNS multicast group
-
#leave_multicast_group : Nil
Leave the mDNS multicast group
-
#multicast_address : String
Get the multicast address for this socket's family
-
#receive(buffer : Bytes, timeout : Time::Span) : Tuple(Int32, Socket::IPAddress) | Nil
Receive data with a timeout
-
#receive(buffer : Bytes) : Tuple(Int32, Socket::IPAddress)
Receive data from the multicast group
-
#send_multicast(data : Bytes) : Int32
Send data to the mDNS multicast group
- #socket : UDPSocket
- #socket=(socket : UDPSocket)
Constructor Detail
Instance Method Detail
Join the mDNS multicast group
RFC 6762 §5.1: All mDNS responders and queriers MUST join the multicast group
Receive data with a timeout
@param buffer Buffer to receive data into @param timeout Timeout duration @return Tuple of (bytes_received, sender_address) or nil if timeout
Receive data from the multicast group
@param buffer Buffer to receive data into @return Tuple of (bytes_received, sender_address)
Send data to the mDNS multicast group
@param data The DNS packet bytes to send @return Number of bytes sent