in reply to send call on udp socket
The send system call will give you an error if it failed to send the UDP packet. I would check the return value of the send function, as you are doing, to check the status of the send system call.
Determining whether the packet was received and processed as intended at its destination is something quite different. For that I would have the receiving process return status via a return UDP packet. If you receive a reply, then you know the remote end received the packet and whether it was processed successfully or not. If you don't receive a reply, there might be a problem at the remote end, or there could be a network problem in the return path. You might resend after a timeout and repeat some reasonable number of times, after which you might assume a problem and log an error.
You may need identifiers (e.g. sequence numbers) in your messages so that status messages can be correlated with sent messages. For example, if you send two messages and receive only one reply, you might need to know which of the two messages the reply corresponds to.
|
|---|