Hi,
I was looking at using port mapping for udp networking in my game. I saw the TCMPortMapper framework (Link) and I'm not sure what will happen when it, or any form of port mapping, updates the mappings. If I'm in the middle of sending data, and it updates ports (with the 'refresh' method), is it possible that it will interrupt the connection? Like, if I'm originally mapping to the external port 8888, can the update change the port number, so then one client is receiving through the new port, but the other client is still sending to port 8888?
If this is the case, is it safe to ignore network changes until a game or transfer is over, and then update the mappings?
Thanks
TCMPortMapper
I was looking at using port mapping for udp networking in my game. I saw the TCMPortMapper framework (Link) and I'm not sure what will happen when it, or any form of port mapping, updates the mappings.
In a perfect framework, connections are persistent. For example, in HAProxy (a reverse-NAT capable TCP proxy), when you change the config file, it will keep all existing connections the way they are, but any new connections will get the new hehavior (unless you force it to kick the old connections out).
Meanwhile, iptables (a reverse-NAT capable packet dispatch engine) does not have this behavior; it instead starts applying whatever rule you give it right away. This may mean that existing connections may suddenly "stall out" because packets that were flowing will go somewhere else, where they're not recognized.
It sounds like your question is specific to the framework in question, which I have no experience with -- see if they have a support mailing list or forum where you can ask.
Alright, thanks. I didn't know it varied between frameworks.
Looking at that library more, it is a UPnP client library. This will find a UPnP router and edit its port mapping. Whether old connections keep working or not depends on the workings of that router, not on the framework.
UPnP is fundamentally broken as a concept, though.
First, it lets "things" on the inside of your network edit settings for your firewall -- just what you want if you're a virus/trojan program who don't like firewalls!
Second, what if two different machines want the same port? Support MyGame uses port 12345, but there are two different players of MyGame on the network. They can't both get traffic forwarded from port 12345!
Yet, vendors keep supporting it. Whether it's on or off by default when you buy a new router seems to depend on the brand. Personally, I always turn it off if it's on.
That doesn't sound very good then... I'm rethinking my options now. I was thinking about using a STUN server, but if I sell my game, would I be able to use one of publicly available servers, or would I have the run my own? If I do have to run my own, would it be better just to get a cheap VPS and write a basic c handshake server?
That doesn't sound very good then... I'm rethinking my options now. I was thinking about using a STUN server, but if I sell my game, would I be able to use one of publicly available servers, or would I have the run my own? If I do have to run my own, would it be better just to get a cheap VPS and write a basic c handshake server?
STUN doesn't solve the entire problem, because the two clients that want to talk to each other still need to KNOW about each other. A server that does matchmaking/discovery is also ideally suited to do NAT introduction. Hence, any networked game that wants to provide a simpler mechanism than "enter your peer's IP and port number here, and tell them to set up port forwarding" generally ends up with that solution.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement