06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Return Value<br />

Error Codes<br />

addr Points to a sockaddr_in structure that contains the address of the<br />

foreign socket. The structure sockaddr_in is defined as follows:<br />

struct sockaddr_in {<br />

short sin_family; /* must be AF_INET */<br />

unsigned short sin_port; /* 16-bit port number */<br />

struct in_addr sin_addr; /* 32-bit IP address */<br />

char sin_zero[8]; /* must be 0 */<br />

};<br />

This structure cannot be packed.<br />

addrlen Specifies the size in bytes of the sockaddr_in structure and must<br />

be 16.<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 />

0x5024 EINPROGRESS The socket is non-blocking and the<br />

connection cannot be completed immediately.<br />

0x5025 EALREADY The socket is non-blocking and a previous<br />

connection attempt has not yet<br />

been completed.<br />

0x502F EAFNOSUPPORT The sin_family member of<br />

sockaddr_in isn’t AF_INET.<br />

0x5030 EADDDRINUSE The address specified is already in<br />

use.<br />

0x5031 EADDRNOTAVAIL The specified address is not available.<br />

0x5037 ENOBUFS An internal buffer is required but<br />

can’t be allocated.<br />

0x5038 EISCONN The socket s is already connected.<br />

0x503C ETIMEDOUT Connection timed out.<br />

0x503D ECONNREFUSED The attempt to connect was refused.<br />

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