On Fri, Aug 29, 2008 at 08:06:05PM +0900, Andrew Parlane wrote: > Antonin, > > I know what you mean, i said it was sudo code, and bind was the best i > could think of to describe what I meant. However your socket on the > client side has to bind to an IP, for it to work, if you look at raw > sockets, you are able to specify which IP address your connection goes > through. > > John, > > I'm trying to write a http client to download pages off a server I don't > own. The client however can only connect to the server once a seccond if > it only uses one IP, however the client is running on a machine that has > 4 IP addresses, defined as eth0, eth0:0, eth0:1, eth0:2, I want the > client to send the request from a different one of those each time. The > example I gave about the server returning the IP address was just an > example to show what should be returned. If this is something that you are going to need to do for an extended period of time, you may think about using a tinyproxy + haproxy solution. Bind an instance of tinyproxy to each external IP address, and then have haproxy load balance between the 4 instances. Then your code could just hit the haproxy incoming port and it would be sent to one of the outgoing ip addresses automatically. Something like: ( haproxy : http://haproxy.1wt.eu/ ) haproxy proxy has a configuration somewhat like: listen proxy-in 10.0.0.1:10000 mode http balance roundrobim server tiny1 10.0.0.1:10001 server tiny2 10.0.0.1:10002 server tiny3 10.0.0.1:10003 server tiny4 10.0.0.1:10004 ( tinyproxy : http://www.banu.com/tinyproxy/ ) Then you have 4 tinyproxy instances: listen at proxy to #1 10.0.0.1:10001 192.168.1.1 #2 10.0.0.1:10002 192.168.1.2 #3 10.0.0.1:1000e 192.168.1.3 #4 10.0.0.1:10004 192.168.1.4 I've done things like this before and it works out pretty well. Then your download code just hits 10.0.0.1:1000 as if it were an http proxy and you're good to go. enjoy, -jeremy -- ======================================================================== Jeremy Hinegardner jeremy / hinegardner.org