Pike v8.0 release 1738

Method Stdio.UDP()->bind()


Method bind

UDP bind(int|string port, string|void address, string|bool no_reuseaddr)

Description

Binds a port for receiving or transmitting UDP.

Parameter port

Either a port number or the name of a service as listed in /etc/services.

Parameter address

Local address to bind to.

Parameter no_reuseaddr

If set to 1, Pike will not set the SO_REUSEADDR option on the UDP port.

Note

SO_REUSEADDR is never applied when binding a random port (bind(0)).

In general, SO_REUSEADDR is not desirable on UDP ports. Unless used for receiving multicast, be sure to never bind a non-random port without setting no_reuseaddr to 1.

Throws

Throws error when unable to bind port.