Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Re: Using SOAP::Transport::IO::Server to process request

Expand Messages
  • Duncan Cameron
    ... Presumably this works, but what is the above line actually testing? ... ... I suggest using HTTP::Daemon to construct your server. That should
    Message 1 of 5 , Feb 2, 2002
    View Source
    • 0 Attachment
      On 2002-02-01 ian c rogers <ian@...> wrote:

      >Let me explain in a bit more detail what I'm trying to do, as I feel I might
      >be approaching this the wrong way. I have a simple program that has a
      >simple (forking) HTTP server within it. The HTTP server may be called upon
      >to serve a few specific files, or it may receive a SOAP request. I handle
      >either by reading in the HTTP header like so:
      >
      > # Read HTTP header info
      > LINE: while ( $buf = <CLIENT> ) {
      > chomp( $buf );
      > last LINE if ( length( $buf ) == 1 );

      Presumably this works, but what is the above line actually testing?

      > $some_data .= "$buf\n";
      > }
      >
      <snipped>

      >On the timeout run, the header info is read, but the server blocks forever
      >on the recv() at LINE. I've added some code to take a look at the socket to
      >see if there's any data to be read there, and as you might guess, sometimes
      >there isn't (which avoids the timeout but not the larger problem). Why not?
      >
      >Clearly I'm no whiz at handling the transport myself and I'd prefer not to.
      >Is there another way in my case? If not, suggestions? Any idea why my
      >soap_client.pl would be sending header only then blocking sometimes? What
      >other factors might be to blame?

      I suggest using HTTP::Daemon to construct your server. That should
      avoid many of the possible problems which you might be hitting.

      Also, I'm no expert in sockets but is it a good idea to mix stdio type
      input (using <CLIENT>) and recv() input on the same socket?
      There should be a Content-length header which tells you _exactly_ how
      many bytes to read so you don't have to read one byte at a time.

      Regards

      Duncan Cameron
    Your message has been successfully submitted and would be delivered to recipients shortly.