25.02.2013 Views

TCP/IP Tutorial and Technical Overview - IBM Redbooks

TCP/IP Tutorial and Technical Overview - IBM Redbooks

TCP/IP Tutorial and Technical Overview - IBM Redbooks

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.

Definition of fields:<br />

sockfd This is the socket on which the application is to listen. This is<br />

the value obtained previously from the socket function.<br />

queuesize This is the number of inbound requests that can be queued<br />

by the system at any single time.<br />

Note: The listen() function is typically invoked by server applications.<br />

The function is called to await inbound connections from clients.<br />

► Accept an inbound connection<br />

Format:<br />

accept(sockfd, remoteaddress, addresslength)<br />

Definition of fields:<br />

sockfd This is the socket on which the connection is to be accepted.<br />

This is the value obtained previously from the socket<br />

function.<br />

remoteaddress This is the remote socket address structure from which the<br />

connection was initiated.<br />

addresslength This is the length of the socket address structure.<br />

Note: The accept() function is typically invoked by server applications to<br />

accept connections from clients. The remote address is a place holder in<br />

which the remote address structure will be stored.<br />

► Connect outbound to a server<br />

Format:<br />

connect(sockfd, remoteaddress, addresslength)<br />

Definition of fields:<br />

sockfd This is the socket from which the connection is to be opened.<br />

This is the value obtained previously from the socket<br />

function.<br />

remoteaddress This is the remote socket address structure to which the<br />

connection is to be opened.<br />

addresslength This is the length of the socket address structure.<br />

Note: The connect function is typically invoked by client applications.<br />

412 <strong>TCP</strong>/<strong>IP</strong> <strong>Tutorial</strong> <strong>and</strong> <strong>Technical</strong> <strong>Overview</strong>

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

Saved successfully!

Ooh no, something went wrong!