HP Rp7410 BSD Sockets Interface Programmer's Guide - Page 96
Receiving Messages
View all HP Rp7410 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 96 highlights
Using Internet Datagram Sockets Sending and Receiving Messages Parameter Description of Contents INPUT Value flags to tolen settings for optional flags address of recipient socket size of to 0 (no options are currently supported) pointer to the socket address that message should be sent to length of address structure that to points to Function result: Number of bytes actually sent, -1 in the event of an error. Example: count = sendto(s,argv[2],strlen(argv[2]),0,servaddr,sizeof(struct sockaddr_in)); The largest message size for this implementation is 32767 bytes. You should not count on receiving error messages when using datagram sockets. The protocol is unreliable, meaning that messages may or may not reach their destination. However, if a message reaches its destination, the contents of the message are guaranteed to be intact. If you need reliable message transfer, you must build it into your application programs or resend a message if the expected response does not occur. When to Send Data The client or server process should send data after sockets are bound. Refer to the send(2) man page for more information on sendto and sendmsg. Receiving Messages Use recvfrom or recvmsg to receive messages. recvmsg allows the read data to be scattered into buffers. 96 Chapter 4