Advertisement Jump to content
Sign in to follow this  
Unconquerable

Connecting to Self

This topic is 4580 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'm playing around wtih Johnnie's Winsock tutorials ( http://johnnie.jerrata.com/winsocktutorial/). I'm trying to connect to myself via the client while the host is running. So I'm using 127.0.0.1. But when i try to connect, i get a winsock error that the connection was refused? I'm new to this and was wondering if anyone could help. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You're probably connecting to the wrong port. The server needs to bind to a known port (say, 54321), and the client needs to connect to that specific port. 127.0.0.1 is like a street name ("your computer") -- you also need the right house number to connect.

Btw: ports should be passed through htons() before being passed to bind() or connect().

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!