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.

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

close Closes a socket descriptor.<br />

#include <br />

long close(<br />

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

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

See Also<br />

The close() call discards the specified socket descriptor. If it is the last descriptor<br />

associated with the socket, the socket is deleted and, unless the SO_LINGER socket<br />

option is set, any data queued at the socket is discarded. Refer to the<br />

setsockopt() pNA+ call for a discussion of the SO_LINGER option.<br />

As a special case, if the specified socket descriptor is equal to 0, close() closes all<br />

socket descriptors that have been allocated to the calling task.<br />

s Specifies the socket to be closed.<br />

This system call returns 0 if successful, otherwise it returns -1.<br />

Hex Mnemonic Description<br />

0x5009 EBADS The socket descriptor is invalid.<br />

0x5016 EINVALID An argument is invalid.<br />

socket, setsockopt<br />

4-8 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

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

Saved successfully!

Ooh no, something went wrong!