Import std.net.lan
LanAnnouncer
class
Public Class LanAnnouncer
Offers a service to the LAN: it answers what Lan.Find and DNS-SD's other browsers ask, on the main thread, as Async code does, from Start until Stop, or until it goes, keeping the program running meanwhile, as a listener's AcceptAsync does. It doesn't check that no other service of its type has its name, as a DNS-SD responder's probe would, so names should differ, by the machine's name, say.
-
@PanicsAtCaller Public Static Method Start(type: String, name: String, port: UInt16, text: Map<String, String>? = Null, discoveryPort: UInt16 = MDNS_PORT): LanAnnouncer Throws NetErrorstatic method #Starts offering the service
nameoftype, which is "_" and up to 15 lowercase letters, digits, and '-', then "._udp" or "._tcp", atportof this machine, withtextas its keys and values, each pair 255 bytes at most and 8192 in all, each key once whatever its letters' case. A type,name, ortextthat isn't one panics. It answers at mDNS's port, 5353, or atdiscoveryPort, which Find has to be given too. What it sends through an interface gives that interface's address alone, as RFC 6762 has it. -
Its service, as Find gives it, with this machine's addresses.
-
Whether Stop stopped it.
-
Says goodbye to the LAN, so other mDNS caches drop the service's records, but not its host's addresses, which other services can have, and stops answering.
Report an issue with this page or with FutureBlitz on GitHub.