SFML community forums
Help => Network => Topic started by: CJ_COIMBRA on January 20, 2011, 02:41:54 am
-
Hi there,
Is there a way of handling this internal IP problem with SFML classes?
I mean, someone under a router get´s a 192.168.... IP which won´t work with TCP sockets...
I ´ve tested my game´s latest build with hamachi and it works, but I´d rather tackle this internal IP issue to avoid losing players!
Thanks
-
As far as I have tested, TCP sockets work internally.
-
Hmm, I don´t know if I expressed myself correctly. What I am trying to say is that in a peer to peer game, if one of the parts are under router then the packets aren´t getting there!
The code is fine because with no router, or with hamachi it runs smooth!
Thanks...
-
Ah. That is a forewall/router problem. You need to allow the port in the firewall or forward the port on the router. This is a common problem.
-
So, by no means it can be dealt with in the code?
And if it is a common problem, is that acceptable to just let my game´s networking as it is right now (not dealing with router issues) ?
-
You're right, it has nothing to do with the code. Leave your code as it is. If you release the code, tell the user what port your networking uses, so they can open it on their router/firewall.
-
It´s true. I´ve seen games that tell the port they use and so, bu there are others that work great even under a router. I am curious about how they solve this...
-
If you receive connections (you're a server) you need to open the corresponding port(s), but if you initiate the connection you can then receive responses from the server without opening the port on your side. I think :mrgreen:
There's a way to automatically open ports (if it's supported by the router): it's called uPnP and there's a C library for it called mini-uPnP.