Home  Contents

rawio:sendto

Rawio Core4 Lua Event System

SYNOPSIS

len = handle:sendto(host, port, data[, flags])

DESCRIPTION

This call works only on UDP sockets.

Sends data to the port number port at the host with ip address host.

The number of bytes written may be less than the length of data if it exceeds the maximum packet size.

The optional flags parameter is not supported currently, and should be nil if passed at all.

RETURN VALUE

On success, returns the number of bytes written, on failure, returns nil. In case of an error, the error can be retrieved using rawio:lastError().

NOTES

Please note that Lua considers the number '0' true. Using
if (handle:sendto(...)) print("OK")
will happily print OK if zero bytes where written.

SEE ALSO