Click to See Complete Forum and Search --> : Select one of multiple IPs for HTTP


MarcKane
May 5th, 1999, 04:38 PM
Hi,

I am writing a game server that should connect to multiple clients via
http. Our server has multiple IPs in its network setup and I would
like to be able to select the IP that the code is going to use
dynamically at any moment, like this:

Player input on 10.0.0.1
Select 10.0.0.1, send out data to player 1
Select 10.0.0.2, send out data to player 2
...

Since both IIS4 and proxies can work with multiple, "dynamic" IP
numbers, it should be possible, but how? - Any hints and/or pointer
will be greatly appreciated!!!

Best regards,

Marc
marc@neogeo.com

Jason Coene
May 18th, 1999, 10:55 AM
Well, first you would want to decide which adapter's IP to use, depending on the load on each individual Adapter. To do this, you would want to be able to access every connected socket, and see what adapter its attatched to. Then, take the adapter which has the lowest amount of connections.

To make the connection bind to a certain adapter, make the socket that is listening call bind() and bind to that specific IP. Then, when a connection is made, bind it to the other. Or accept to the other adapter.

Refer to winsock 2 referance for more info.