Okay...Here is some code.....I in this version it won't connect the second until the first is done reading....I understand that the <$socket> is 'blocking' but does that effect children and forks??

use IO::Socket::INET; #ignore child processes to prevent zombies $SIG{CHLD} = 'IGNORE'; my $socket = IO::Socket::INET->new( LocalPort => 1776, Type => SOCK_STREAM, Reuse => 1, Listen => 10 ) or die "Big Problem with the Server, Man : $!\n\n"; while ( my $client = $socket->accept() ) { my $child; # perform the fork or exit die "Can't fork: $!" unless defined ($child = fork()); if ($child == 0) { #i'm the child! #close the child's listen socket, we dont need it. $socket->close; #call the main child rountine print $client 'Hello, down there!!', "\n\n"; $msg = <$client>; ### ** When one child is here the others seem t +o hang until its done ** #if the child returns, then just exit exit 0; } else { #i'm the parent! #who connected? warn "Connecton recieved ... ",$client->peerhost," ... Sent to Chi +ld: $child\n"; #close the connection, the parent has already passed # it off to a child. warn "Waiting for Child to start...\n"; sleep(1); # Give the child a moment to start warn "Closing Parent connection.\n\n"; $client->close(); } } close($socket); exit 0;

In reply to Re: TCP IO:Sockets problem by otijim
in thread TCP IO:Sockets problem by otijim

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.