Home Contents | # Socket options | Rawio | Core4 Lua Event System

## SYNOPSIS

#include <lua/socket.lh>

1. flag = handle:setsockopt(level, optname, value)
2. value = handle:getsockopt(level, optname)

## DESCRIPTION

rawio:getsockopt() and rawio:setsockopt() manipulate the options that are associated with a socket.

Level | optname | Description
--- | --- | ---
SOL_TCP | SO_NODELAY | A flag which, when non-zero, disables the nagle algorithm for TCP sockets. This means that data packets are sent as soon as possible instead of buffering them. This usually results in poor network performance.
SOL_SOCKET | SO_DEBUG | A number value which enables printing of tracing messages to the kernel log when non zero. Higher values enable more verbose debugging.

## RETURN VALUE

On success, rawio:setsockopt() returns true and rawio:getsockopt() returns the queried value. On error, both functions return nil. In case of an error, the error can be retrieved using rawio:lastError().

## SEE ALSO

rawio:accept, rawio:bind, rawio.ifconfig, rawio.interfaces, rawio:listen, rawio:recvfrom, rawio:sendto, rawio:shutdown, rawio.socket