Advertisement

Understanding when UPD fails

Started by July 12, 2004 04:02 PM
3 comments, last by Matei 20 years, 7 months ago
Hi, I'm pretty new in network programming, and I have to understand how can I know if and UDP send fails and how ca I recover the message sent (if it is very importanat). Some code will be very useful for me. I use winsock, but I should understand also UNIX-dependent code ... bye ;)
You don't.

Generally people get around that limitation by storing messages sent until the recipient returns some sort of verification. If the verification is not recieved in a certain amount of time, the send is assumed failed, and the message resent.

Advertisement
Ok...

So I should verify that all the data has been sent looking (for instance) at the last bytes to see if them correctly refers to what I need?

Can I have some simple pseudo-code for starting?

Another question: someone told me that I should use TCP for chatting and for authentication, so I'm sure that the whole mssage is recived correctly ... but in this way I have to store a TCP socket for every client, losing a lot of resources then using UDP ... right?
Don't know. I just use TCP for everything. Adding an extra socket for each client is going to be far less resources than keeping a list of un-ack'd UDP messages...

Personally, I've never understood the facination with UDP around here.
What kind of program are you making? If you're only sending a couple of messages per second, you don't usually need UDP. Even if you do decide to use UDP later, you might learn more by using TCP for the early versions.

This topic is closed to new replies.

Advertisement