🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
How to run a C-S on a LAN with 'invalid' IP address?
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 ?
bind() doesn''t connect to another machine, it specifies which interface on the local machine you want to send packets through.
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.
And there came my problem. The bind() function returns error.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement