Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

haigu

How to run a C-S on a LAN with 'invalid' IP address?

This topic is 6301 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 making my networked game and want to test it on a LAN. In our LAN we use ''invalid'' IP addresses such as ''192.168.0.1''. Now suppose my machine is ''192.168.0.1'' and another machine is ''192.168.0.2'' It is all very well if I connect to ''.0.1'', or my local machine. But if i connect to ''.0.2'', the remote one, I get an WSAEADDRNOTAVAIL error, when calling bind() function. How to solve this problem ?

Share this post


Link to post
Share on other sites
Advertisement
bind() doesn''t connect to another machine, it specifies which interface on the local machine you want to send packets through.

Share this post


Link to post
Share on other sites
I''m using TCP to bring up a UDP ''connection''. Because that the outgoing interface is determined when sending the first UDP packet if the socket is not bound, so I want to bind it, and tell the server which interface the client''s UDP socket is using.
And there came my problem. The bind() function returns error.

Share this post


Link to post
Share on other sites
Do a little test for me... call bind passing INADDR_ANY for sin_addr. Using that, the computer will use it''s routing table to determine which interface to send packets through.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!