For Programmers: Free Programming Magazines  


Home > Archive > PERL POE > April 2008 > simpleHTTP flushing problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author simpleHTTP flushing problem
vidals

2008-04-02, 9:12 am

Does anyone have experience with POE::Component::Server::SimpleHTTP?

I need help in understanding how to flush my response immediately upon
calling $_[KERNEL]->call( 'HTTPD', 'DONE', $response );

Here are the two lines in question taken from my "sub GOT_REQ":

$_[KERNEL]->call( 'HTTPD', 'DONE',
$response );
$_[KERNEL]->post( 'PROCESS_XML',
'create_xml_response', $nf, $xml_request );

I need the "call" to occur immediately and send a 0 (ok) or 1 (error)
to the client. AND THEN AFTER continue to process the xml request in
another session called PROCESS_XML. However, the 0 or 1 is *not* being
sent out to the client until after the PROCESS_XML session finishes,
which can take more than a minute. Why doesn't call('HTTPD'...) output
right away?

Any help would be greatly appreciated.

sub GOT_REQ {
# ARG0 = HTTP::Request object, ARG1 = HTTP::Response
object, ARG2 = the DIR that matched
my( $request, $response, $dirmatch ) = @_[ ARG0 ..
ARG2 ];

$response->code( 200 );

my $xml_request =
&retrieve_multipart_content($request, $response);
my $nf = &parse_content( $xml_request );

$response->content( $nf->{ReturnCode} );

# We are done! For speed, you could use $_[KERNEL]-
>call( ... )

$_[KERNEL]->call( 'HTTPD', 'DONE',
$response );
$_[KERNEL]->post( 'PROCESS_XML',
'create_xml_response', $nf, $xml_request );
}

Gil Vidals

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com