Hi Andy,
Thanks for the clarification, but I still don't quite understand what
you are trying to do here.
You said originally:
//
The reason for this is to be able to paralelize web page downloads from
a site that has a max of 1 hit per seccond per IP address.
//
And then in a follow-up post: (Which clarified that you are writing a
HTTP client of some sort I think).
//
now if the url was for a page that had no content, except for the IP
address
//
So you seem to have control over both client and server here I think?
My networking isn't that great, and I'm a Ruby-Newbie...but I think from
the client side this is a non-issue: the client just connects to an IP
(or host) directly and a port: if you know the IPs ahead of time, just
connect to them.
So I think then you are designing something like:
- A webserver which has multiple NICs , and one (perhaps) 'master' NIC.
- This webserver will return as plain-text (or XML or some data-format)
a list of these IP addresses.
- The client is able to make an initial-request to the 'master' NIC/URL
to retrieve a list of other hosts (the fact they are in fact located on
the same machine is not really relevant to the client).
- Once the client has this list of IPs it can just connect to them and
download whatever it wants.
So, (I think): so long as your webserver is listening on all NICs (or
you have multiple dedicated webservers listening on per NIC), you have a
fairly straight-forward programming task I think:
- A servlet to generate the IP address file, which sits on the server.
- Some client code to retrieve and process that IP address file and set
of some threads in parallel.
Correct ?
I guess you might want to share some sort of context between the
different parallel clients: you could use a cookie and (somesort) of
shared background context between web-servers : maybe a database, or
files in a shared directory ?
In short: I *think* there is essentially no big deal about getting a TCP
client to talk to a specific NIC - you just address with the IP address
and everything is just taken care of at the network layer.
I think you are writing an ad-hoc load-balancer here by the sound of
it...
Cheers
John
···
--
Posted via http://www.ruby-forum.com/.