469,929 Members | 1,751 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,929 developers. It's quick & easy.

Asynchronous http request

In a Perl script I want to send several http requests WITHOUT waiting
for the remote servers answer (i.e. just triggering http requests) and
without having to create lots of processes...

Thanks in advance

François-Xavier
Jul 19 '05 #1
3 8076
fx@testard-vaillant.com (Fran?ois-Xavier Testard-Vaillant) wrote in message news:<b2**************************@posting.google. com>...
In a Perl script I want to send several http requests WITHOUT waiting
for the remote servers answer (i.e. just triggering http requests) and
without having to create lots of processes...


Have you tried LWP::Paralell?

This newsgroup does not exist (see FAQ). Please do not start threads here.
Jul 19 '05 #2
> Have you tried LWP::Paralell?

As far as I understand LWP::Paralell it allows me to paralellize
several HTTP requests, i.e. not waiting for the end of the first one
to send the second one and so on.
What I need is to send a bunch of requests and leave, not waiting for
the results and not killing them.
The only way I found to do this is to fork the current process and
kill the father. But due to what I want to do (propagation in a
graph), it could create a lot of processes.

fxtv
Jul 19 '05 #3
fx@testard-vaillant.com (Fran?ois-Xavier Testard-Vaillant) wrote in message news:<b2************************@posting.google.co m>...
Have you tried LWP::Paralell?


As far as I understand LWP::Paralell it allows me to paralellize
several HTTP requests, i.e. not waiting for the end of the first one
to send the second one and so on.
What I need is to send a bunch of requests and leave, not waiting for
the results and not killing them.
The only way I found to do this is to fork the current process and
kill the father. But due to what I want to do (propagation in a
graph), it could create a lot of processes.

fxtv

- use a very short timeout?/tweak LWP to have a 0 timeout
or
use a typical LWP::UserAgent request, but disable the read
from the connected socket after the http request was
transmitted in LWP/Protocol/http.pm @ (yep, need to change the LWP
code, its a shame!)

# read response line from server
LWP::Debug::debug('reading response');

I guess a statement like return HTTP::Response->new()
might work,right after the debug print, but you need
to sort it out for yourself.

Don't know what the effects are perhaps all kind of tcp/ip
buffers will overflow (get flusshed if you die).

getting the request data back would require splitting the
sender and reciever parts into two threads (1 fork), or another
trick would be to start reading after the 2nd request, getting
the results back from the 1st request (or even wait N requests
before starting to read to circumvent tcp/ip buffer overlflows).

I guess I'm redoing LWP::Paralell (in a singletrheaded model)
(or is it the same, duno, never seen it,used it,sorry)

b2w there are easier ways to dump lots data in tcp/ip ports like 80
, see perldoc -f socket and send.
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Marty McDonald | last post: by
3 posts views Thread by Thomas Nielsen | last post: by
1 post views Thread by Julian Hershel | last post: by
reply views Thread by Bishoy George | last post: by
4 posts views Thread by Engineerik | last post: by
4 posts views Thread by Morgan Cheng | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.