chickadee » udp6 » udp-bind!

udp-bind! SOCKET HOST PORTprocedure

Binds a UDP socket to an address and port as specified by HOST and PORT. HOST may be a string consisting of an IP address or hostname, or #f, in which case the unspecified address is used. If PORT is 0, a port will be allocated by the system automatically.

To use IPv6, create a UDP socket with family 'inet6. If the socket is in the IPv4 address family, as is the default, binding to an IPv6 address will raise an exception. Example:

(define s (udp-open-socket 'inet6))
(udp-bind! s "::" 1337)

Binding to the unspecified IPv6 address "::" may, depending on your OS, also allow connections via IPv4. See socket-bind in the socket egg for an example of disabling this behavior.