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.

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

Return Value<br />

msg_iov Points to an array whose members<br />

(msg_iov[0], ..,msg_iov[msglen-1]) specify<br />

the buffers in which the received data is<br />

stored. The iovec structure has the following<br />

format:<br />

struct iovec {<br />

char *iov_base: /* base address */<br />

int iov_len; /* buffer length */<br />

};<br />

This structure cannot be packed. Each iovec<br />

entry specifies the base address and length of<br />

an area in memory where data is stored.<br />

recvmsg() always fills an area completely<br />

before it goes to the next area.<br />

msg_accrights Points to a buffer that receives the access<br />

rights information sent along with a message.<br />

This applies to messages that a UNIX host<br />

sends.<br />

msg_accrightslen Specifies the length of the buffer pointed to by<br />

msg_accrights.<br />

flags Specifies usage options and is the result of an OR operation performed<br />

on one or more of the following symbolic constants (defined in<br />

). It can also be set to 0.<br />

MSG_OOB Specifies that you want recvmsg() to read<br />

any out-of-band data present on the socket,<br />

rather than the regular in-band data.<br />

MSG_PEEK Specifies that you want recvmsg() to peek at<br />

the data present on the socket; the data is returned,<br />

but not consumed, so that a subsequent<br />

receive operation sees the same data.<br />

This system call returns the number of bytes received, or it returns -1 if an error<br />

occurs. When the receive is shutdown by either end of the connection, a value of 0 is<br />

returned.<br />

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