0
votes

sendto() & recvfrom() socket API is used to send a packet over UDP.

We have a scenario where, Node1(UDP client program) sending a UDP packet to Node2(server which is UP) & Node3(server which is down).


TCP performs handshake before start and after finishing data communication. UDP doesn't.

So, Does application running on Node1 fail for a reason that server program on Node3 is not ready(down) to receive UDP packets?

2
UDP packets are send-and-pray. If anyone receives them, great. If no one does, well, that's OK too. Nothing on the receiving end should cause the sender to fail. Of course, the sender might be something like a DNS server, that sends out request packets and expects someone to respond, but still it is in full control--it should be written so that if no response comes, it simply reports that without causing a failure. - Lee Daniel Crocker
Well yes. That’s what UDP does. You must have considered such possibilities when you designed-in use of fire-and-forget UDP. - balmy

2 Answers

1
votes

UDP protocol doesn't let you know whether the data is transmitted since it doesn't have such a property. There is no any problem flow of the program. In my opinion, it's the case why datagrams are useful.

1
votes

It won't fail, the transaction simply won't happen. Having said that, any and all packets that aren't recieved are lost.