Hello, I have a question about IO::Socket use. To provide some extra background, and answer "Why I am not using other Server modules?", I am writing a specialized proxy server that will handle quite a few things, and it is going to have special functionality that the other server modules as well as other proxy modules do not have in them. I have written a perl script that acts as a poor man's version of a webserver. I am using IO::Socket to setup the server like such:

$server = IO::Socket::INET->new (
LocalPort => 8080,
Type => SOCK_STREAM,
Reuse => 1,
Listen => 10) or die "$@\n\n\n";

binmode $server;
print "\n\nServer Started...\n";
print "\t listening on port 8080......\n\n";

while ($client = $server->accept()) {
$client->autoflush(1);
binmode($client);

next if my $pid = fork;
die "fork - $!\n\n" unless defined $pid;

$client_line = <$client>;
( $method, $hostAddr, $httpVer ) = $client_line =~ /^(\w+) +(\S+) +(\S+)/;

Also, I check to see what method the user is using to send me data (GET, POST, CONNECT). I have the system process the GET calls without any problem, but I can't seem to get server to accept all the POST input from a client. What I want to do is accept all input from the post prior to processing it. I assume this is similar to how a larger server does it. Can someone provide me a sample for having the server chat back to the client to get all POST information? I would like to say thank you in advance for any help. Thanks, R1n0

In reply to IO::Socket use in Small Web Server for POST/GET methods by r1n0

Title:
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, details, 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, summary, 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.