Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: internal IP problem  (Read 3664 times)

0 Members and 1 Guest are viewing this topic.

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
internal IP problem
« 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
CJ

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
internal IP problem
« Reply #1 on: January 20, 2011, 04:19:27 am »
As far as I have tested, TCP sockets work internally.

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
internal IP problem
« Reply #2 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...
CJ

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
internal IP problem
« Reply #3 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.

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
internal IP problem
« Reply #4 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) ?
CJ

tntexplosivesltd

  • Full Member
  • ***
  • Posts: 163
    • View Profile
internal IP problem
« Reply #5 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.

CJ_COIMBRA

  • Full Member
  • ***
  • Posts: 112
    • ICQ Messenger - 13077864
    • View Profile
    • http://www.cjcoimbra.com
    • Email
internal IP problem
« Reply #6 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...
CJ

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
internal IP problem
« Reply #7 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.
Laurent Gomila - SFML developer