HP Rp7410 BSD Sockets Interface Programmer's Guide - Page 157
settings
View all HP Rp7410 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 157 highlights
Using UNIX Domain Datagram Sockets Sending and Receiving Messages Parameter Contents INPUT Value OUTPUT Value s msg len flags from fromlen socket descriptor of local socket socket descriptor of socket receiving the message unchanged pointer to data pointer to buffer buffer that is to receive data pointer to received data maximum number of bytes that should be received size of data buffer unchanged settings for 0 (no options are optional flags supported unchanged address of socket that sent message pointer to address structure, not used for input pointer to socket address of socket that sent the message pointer to the pointer to size of size of from from pointer to the actual size of address returned Function result: number of bytes actually received if recvfrom succeeds, -1 if recvfrom call fails. Example: struct sockaddr_un fromaddr; int fromlen; ... count = recvfrom(s, msg, sizeof(msg), 0, &fromaddr, &fromlen); recvfrom blocks until there is a message to be received. No more than len bytes of data are returned. The entire message is read in one recvfrom, recvmsg, recv, or read operation. If the message is too long for the receive buffer, the excess data are discarded. Because only one message can be returned in a recvfrom call, if a second Chapter 7 157