Jump to content
  • Advertisement
Sign in to follow this  
Decrius

Opening ports

This topic is 3883 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've written a chat app, however: if my PC is the server, the client cannot connect to it. It takes very long, like 10 seconds, and then it says (SDL_net): "Couldn't bind to local port". I've tried port 9999 and 11111, both not working. I've opened those ports on my router and redirect them to my PC in the LAN network. I even put off WinXP firewall...still no results. #1 Any thoughts on this one? #2 Does the client need to open the port on its router? Thanks, Decrius

Share this post


Link to post
Share on other sites
Advertisement
Does it work if you run the server and client on the same machine? If so, are you sure the port is forwarded correctly on the router? Do you know if it's using UDP or TCP (SDL_net probably calls them reliable and unreliable)?

EDIT: If you're running both the client and server on the same LAN, the router probably has nothing to do with it. It usually only comes in if the client is WAN side and the server is LAN side.

Share this post


Link to post
Share on other sites
127.0.0.1 works
192.168.1.101 (my LAN ip) works
But when I type our IP address it doesn't work.

I use the TCP protocol. I've tried http://www.canyouseeme.org/, and it says timed out...and for port 9999 it says refused.

Share this post


Link to post
Share on other sites
Quote:
Original post by Decrius
127.0.0.1 works
192.168.1.101 (my LAN ip) works
But when I type our IP address it doesn't work.

I use the TCP protocol. I've tried http://www.canyouseeme.org/, and it says timed out...and for port 9999 it says refused.
If the client and server are both on the LAN, then the external IP has nothing to do with it.

If the client is outside of the LAN, and the server is inside, then the port needs forwarded. If that website says the connection is refused, that indicates that the server wasn't running; usually routers will just cause the connection to time out if the port is blocked.

Share this post


Link to post
Share on other sites
Okay thanks for your response :)

When I run the server and check for port 9999, it still says refused (canyouseeme.org) and still times out on 11111.

I thought: if I type my external IP while client and server is on the same PC, it would have to go through the router and would simulate a real external connection...however, this doesn't work so far.

Share this post


Link to post
Share on other sites
Quote:
Original post by Decrius
I thought: if I type my external IP while client and server is on the same PC, it would have to go through the router and would simulate a real external connection...however, this doesn't work so far.
I've never got that to work before. I'm sure there's a reason for it, but I don't know what it is. Presumably because the external IP address is only used for external connections, so the server can't reply. Or the router gets confused or something.

If you want to test an external connection, you're going to need an external PC.

Share this post


Link to post
Share on other sites
Looping a connection from a machine through the router back to the same machine works for me. Might be a difference in router model though. My guess though is that the OP hasn't set up the port-forwarding right. I remember I found it tricky when I first tried - even though I had opened the port the firewall settings denied incoming connections.

Share this post


Link to post
Share on other sites
Router loopback is not reliably implemented in all routers, unfortunately. This means you'll have to use an external machine to test your port forwarding if you have a router that's broken like that.

Share this post


Link to post
Share on other sites
Ok guys, call me stupid.

I used the ip either as ip address and as port (argv[1] while it should be argv[2])...=/

Anyways, thanks for your replies. I'm now rebuilding the whole script to make it more organised, than I found out that I used the ip as port, which I didn't open up on my router ofcourse...haven't tested it yet but I'm pretty sure it works now :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!