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.

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

listen Listens for connections on a socket.<br />

#include <br />

long listen(<br />

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

int backlog /* packet queue depth */<br />

)<br />

Description<br />

Arguments<br />

Return Value<br />

Error Codes<br />

See Also<br />

This system call sets up the specified socket to receive connections. Connection<br />

requests are queued on the socket until they are accepted with the accept() call.<br />

The maximum length of the queue of pending connections must be specified. If a<br />

connection request arrives while the queue is full, the requesting client gets an<br />

ECONNREFUSED error.<br />

s Specifies the socket.<br />

backlog Defines the maximum length of the queue of pending connections.<br />

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

Hex Mnemonic Description<br />

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

0x502D EOPNOTSUPP The requested operation isn’t valid for<br />

this socket type.<br />

accept, connect, socket<br />

4-38 <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!