Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello Friends,

I observe the difference in usage.

When $f in the code is INET the client asks server and exits fine. Client code:

use FCGI; use IO::Socket; my $f = 'INET'; my @tcp = ( '', '8888' ); my $lsock = "/tmp/spawn.sck"; my $s; if( $f eq 'UNIX' ){ ( -S $lsock ) and ( unlink( $lsock ) or die $! ); $s = FCGI::OpenSocket( $lsock, 5 ); } else { $s = FCGI::OpenSocket( join( ':', @tcp ), 5 ); } $s or die $!; my $r = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, $s ); while($r->Accept() >= 0) { print "Content-type: text/html\r\n\r\n"; }

Server code:

use IO::Socket; use FCGI::Client; my $f = 'INET'; my @tcp = ( '', '8888' ); my $lsock = "/tmp/spawn.sck"; my $s = $f eq 'UNIX' ? IO::Socket::UNIX->new( "PeerAddr" => $lsock, "Type" => SOCK_STREAM +, Timeout => 3, ) : IO::Socket::INET->new( "PeerAddr" => $tcp[ 0 ], "PeerPort" => $tc +p[ 1 ], "Type" => SOCK_STREAM, Timeout => 3, ) ; $s or die $!; my $c = FCGI::Client::Connection -> new( sock => $s, timeout => 3, ); $c -> request( +{ REQUEST_METHOD => "GET", }, "" ); $s -> close;
But when $f is UNIX, it exits while trying to read from FCGI socket:
REQUEST_TIME_OUT at [.]/FCGI/Client/ line 25 FCGI::Client::Connection::__ANON__('ALRM') called at [..]/FCGI +/Client/ line 92 eval {...} called at [..]/FCGI/Client/ line 92 FCGI::Client::Connection::_wait_socket('FCGI::Client::Connecti +on=HASH(0x28983aa0)', 'IO::Socket::UNIX=GLOB(0x2875d0ac)', undef, 130 +2700410.97483) called at [..]/FCGI/Client/ line 113 FCGI::Client::Connection::_read_timeout('FCGI::Client::Connect +ion=HASH(0x28983aa0)', 'SCALAR(0x289eef84)', 8, 0) called at [..]/FCG +I/Client/ line 63 FCGI::Client::Connection::_read_record('FCGI::Client::Connecti +on=HASH(0x28983aa0)', 'FCGI::Client::Connection=HASH(0x28983aa0)') ca +lled at [..]/FCGI/Client/ line 37 FCGI::Client::Connection::_receive_response('FCGI::Client::Con +nection=HASH(0x28983aa0)', 'IO::Socket::UNIX=GLOB(0x2875d0ac)') calle +d at [..]/FCGI/Client/ line 28 FCGI::Client::Connection::request('FCGI::Client::Connection=HA +SH(0x28983aa0)', 'HASH(0x28796110)', '') called at line 1 +8

What can influence on that behavior? system is freebsd7.

Do I need to send a terminator character/sequence to end my FCGI request?

Or what should I do next? Make FCGI request manually and send it? I believe I can do with Net::FastCGI but I need to look at fastcgi spec for this...

Should this be a FCGI::Client bug?

Thank you.

In reply to client sockets: INET vs. UNIX by petr999

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    Domain Nodelet?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others meditating upon the Monastery: (2)
    As of 2024-07-21 04:19 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found

      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.