Weird VPS behavior with recvfrom()

Started by
1 comment, last by hplus0603 14 years, 6 months ago
Hello, we rented some Windows VPS around the world for our latest multiplayer game. The issue I'm seeing is that when a client closes its socket, instead of the server recvfrom() returning an error with the client's external ip/port, it returns with the client's internal local ip/port (ie. 192.168.0.x). What can be causing this behavior ? Is there a better way to match recvfrom() errors to the corresponding client on the server ? Why does it only happen when we test on a VPS ? Thanks. [EDIT] Also to note : we only see the behavior with people behind a home router. We can't reproduce the issue when people are connecting using the company's network, which seems to be weird seeing how complex the structure can be. [Edited by - md_lasalle on October 23, 2009 11:03:32 AM]
Advertisement
Doing some research, i seem to not be the only one with the issue :

http://codeguru.earthweb.com/forum/showthread.php?t=327522
The "error" from recvfrom() is not guaranteed; it's just a report that the underlying system got an ICMP error for a previous send message. The best way to detect closed clients is to have clients send a bye message, and if that message doesn't make it, detect time-out.

It may very well be that the NAT router that sends the ICMP error message doesn't properly translate the client-internal network address when forwarding it back to the server, because the initial "port not open" message comes from the client inside the client-side NAT.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement