SFML community forums

Help => Network => Topic started by: CJ_COIMBRA on January 20, 2011, 02:41:54 am

Title: internal IP problem
Post 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
Title: internal IP problem
Post by: tntexplosivesltd on January 20, 2011, 04:19:27 am
As far as I have tested, TCP sockets work internally.
Title: internal IP problem
Post by: CJ_COIMBRA on January 20, 2011, 04:28:10 am
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...
Title: internal IP problem
Post by: tntexplosivesltd on January 20, 2011, 04:44:56 am
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.
Title: internal IP problem
Post by: CJ_COIMBRA on January 20, 2011, 04:48:30 am
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) ?
Title: internal IP problem
Post by: tntexplosivesltd on January 20, 2011, 07:24:03 am
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.
Title: internal IP problem
Post by: CJ_COIMBRA on January 20, 2011, 02:27:38 pm
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...
Title: internal IP problem
Post by: Laurent on January 20, 2011, 02:31:35 pm
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.