Hm. This seems to be a platform specific problem--which OS are you running?--because your code (with one minor change), works for me:

C:\test>perl 831580.pl 1234 enter port: 1234 socket OK bind OK listen OK Server started at 192.168.1.31:1234 Server ready. Waiting for connections... got a connection from: 192.168.1.31:52479 IO::Socket::INET=GLOB(0x4d7c +110) list connect to this server: client: 192.168.1.31:52479 4 192.168.1.31:52479 fred 192.168.1.31:52479 bill 192.168.1.31:52479 test 192.168.1.31:52479 more 192.168.1.31:52479 still more from 192.168.1.31:52479: from 192.168.1.31:52479: from 192.168.1.31:52479: from 192.168.1.31:52479: from 192.168.1.31:52479: from 192.168.1.31:52479: hfrom 192.168.1.31:52479: efrom 192.168.1.31: +52479: lfrom 192.168.1.31:52479: lfrom 192.168.1.31:52479: ofrom 192. +168.1.31:52479:

I had to change 1 line:

while( my $tmp = <STDIN> ) { ##sysread(STDIN, $tmp, BUFSIZE) ) + {

because using sysread on STDIN means that no CRLF translation is done and so chomp doesn't do the right thing on my OS.

I strongly suspect that your thread is dying because you are calling die.

Try changing these two lines (remove the \n so that the line numbers are output), and then post your output:

open $client, "+<$fileno" || die "$!"; syswrite( $client, $msg_t ) || die ": +$!";

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

In reply to Re^9: threads with shared variables across multiple instances of a module by BrowserUk
in thread threads with shared variables across multiple instances of a module by fert

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.