Pike v8.1 release 6

Method Stdio.UDP()->send()


Method send

int send(string to, int|string port, string message)
int send(string to, int|string port, string message, int flags)

Description

Send data to a UDP socket. The recipient address will be to and port will be port.

Flag flag is a bitfield, 1 for out of band data and 2 for don't route flag.

Returns
(0..)

The number of bytes that were actually written.

(..-1)

Failed to send the message. Check errno() for the cause. Common causes are:

System.EMSGSIZE

The message is too large to send unfragmented.

System.EWOULDBLOCK

The send buffers are full.

Throws

Throws errors on invalid arguments and uninitialized object.

Note

Versions of Pike prior to 8.1.5 threw errors also on EMSGSIZE ("Too big message") and EWOULDBLOCK .("Message would block."). These versions of Pike also did not update the object errno on this function failing.