tags:

views:

145

answers:

4
+1  Q: 

UDP Lock up?

Hey guys i need people to guess the solution :(.

I am using UDP sockets and what i am doing is sending player input which is about 8, 4 or whatever bytes. I am using recvfrom and sendto. It works for minutes then randomly it will lock up. This could however be because of my app logic but i want to know if anyone have experience with this and it being a UDP/Networking problem. My code is here http://www.pastie.org/486583 but i mostly want to know what i can look into to correct this problem based on your experiences.

+2  A: 

Use Wireshark to figure out which side is failing.

Is it the sender not sending?

Or is it the receiver not receiving?

Robert
A: 

Is your GetInput() function expecting sendTo and recvFrom to always complete? UDP is not guaranteed to send or receive your messages, or in what order the messages will arrive. I think your timeouts are also set to infinity, so what is happening is every once in a while, a message fails and you wait indefinitely for a message that is already lost.

CookieOfFortune
could it get lost on LAN? my router is terrific.
acidzombie24
Doesn't matter, the nature of network traffic and UDP is that messages get lost. The physical wire between your computer and router will cause the signal to be lost. Try to UDP a server half-way around the world and you'll see much more packet loss. TCP compensates and guarantees delivery, if you use UDP, you'll have to implement those features yourself.
CookieOfFortune
A: 

What does "lock up" mean?

Note that the network is allowed to lose (drop) UDP packets: your protocol ought to allow some to be lost occasionally, or be willing to retransmit.

ChrisW
A: 

What does locked up mean and who is getting locked up. You have not checked the return values of "recvfrom" & "sendto" system calls. Have you tried running Wireshark to observe the behaviour.

Aditya Sehgal