Page 1 of 1

Select client IP for connecting to a server

Posted: Thu Jun 28, 2012 5:48 pm
by merendo
Hey folks,

assume a computer has multiple IP addresses which it can use to connect to a server. Is there any way I can tell OpenNetworkConnection() to use any specific IP address for establishing that connection (i.e. the ClientIP() which the server will then see)?

I have already found a solution for this problem but that didn't use native code at all; using this solution would involve rewriting large portions of my application and I'd like to avoid that if possible.

Thanks a lot!
merendo

Re: Select client IP for connecting to a server

Posted: Thu Jun 28, 2012 7:36 pm
by culita
yes TOVARISH you can!

http://www.tomshardware.co.uk/forum/399 ... onnections

and here we go TOVARISH !!!
http://www.r1ch.net/stuff/forcebindip/

combining with your knoledge about networks and purebasic client server programs you got it!

Re: Select client IP for connecting to a server

Posted: Thu Jun 28, 2012 8:36 pm
by DarkPlayer
If you just want to have a fast solution for your self, you can hook the connect api in your application. Instead of allowing Purebasic to call connect directly, you bind the socket to the interface and forward the request to the original api call.

I recommend to use this method only for personal use, as hooking could be intrepreted as some kind of virus or trojan (although a virus hooking it self would be ridiculous) and would fail if the command would just change a bit in the next version of the operating system.

DarkPlayer