06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

pNA+ <strong>System</strong> <strong>Calls</strong> getsockopt<br />

getsockopt Gets options on a socket.<br />

#include <br />

long getsockopt(<br />

int s, /* socket descriptor */<br />

int level, /* SOL_SOCKET, IPPROTO_IP, */<br />

/* or IPPROTO_TCP */<br />

int optname, /* retrieval option */<br />

char *optval, /* return buffer */<br />

int *optlen /* input/output buffer size */<br />

)<br />

Description<br />

Arguments<br />

The getsockopt() system call obtains the status of options associated with the<br />

specified socket. Socket level, IP protocol level, or TCP protocol level options may be<br />

retrieved.<br />

s Specifies the socket.<br />

level Specifies the level of the option to be queried and must be set to<br />

SOL_SOCKET for socket level operations, IPPROTO_IP for IP<br />

protocol level operations, or IPPROTO_TCP for TCP protocol<br />

level operations.<br />

optname Specifies the option to be queried, and uses a symbolic constant.<br />

The symbolic constants available for each level are provided<br />

below and in .<br />

optval Points to a buffer where getsockopt() stores the value for the<br />

requested option. For most options, an int is returned in the<br />

buffer pointed to by optval. A nonzero value means the option<br />

is set, and a 0 means the option is off.<br />

optlen An input-output parameter. On input, it should contain the size<br />

of the buffer pointed to by optval. On output, it contains the<br />

actual size of the value returned in the optval buffer.<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 4-17<br />

4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!