Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

setsockopt() - modify socket options

&pagelevel(4)&pagelevel

#include <sys.types.h>
#include <sys.socket.h>
#include <netinet.in.h> /* only with AF_INET or AF_INET6 */


Kernighan-Ritchie-C:


int setsockopt(s, level, optname, optval, optlen);

int s;
int level; 
int optname;
char *optval;
int optlen;

ANSI-C:
int setsockopt(int s, int level, int optname, char* optval, int optlen);


Description

The level, optname, optval and optlen parameters of the setsockopt() function allow users to modify the properties (options) of the socket interface or of an individual socket s.


level SOL_GLOBAL

In this case, the current parameter value for s is of no significance. For this reason, the value 0 should be specified for s.

optname

*optlen

Value range of optval

SO_ASYNC

4

Pointer to short ID of the event ID

The subfunction SO_ASYNC is only permitted for setsockopt() and is only effective when the user calls the subsystem for the first time.

If this is the case, then the subsystem for this user is switched to an operating mode which permits coordination with other events via a common wait point. optval must then be used to specify the short ID of the bourse’s event ID to which the sockets should send the communication events. These events can then be retrieved with the soc_getevent function.


Comment

In this operating mode, the sockets generated with socket() are automatically generated in non-blocking mode.