in reply to problem with sockets and CRLF and threads

Your SERVER code has two "<$session>", one in each thread.

This is likely the reason you lose data you are expecting at the server.

You probably need to change "while(<$session>)" to "while (my $msgout=<>)" in your "sub sock_io".

Also, I suggest you do a blocking accept in your server, to avoid the busy loop (Research on this left as an exercise).

     "An undefined problem has an infinite number of solutions." - Robert A. Humphrey         "If you're not part of the solution, you're part of the precipitate." - Henry J. Tillman

  • Comment on Re: problem with sockets and CRLF and threads

Replies are listed 'Best First'.
Re^2: problem with sockets and CRLF and threads
by spx2 (Deacon) on May 25, 2007 at 23:27 UTC
    your reply also helped me figgure out my problem
    as i was printing to the session and then starting to read it
    wich was obviously wrong...also becuase $session was used
    in both threads i locked it in each of them so i could
    use it safely and shared it between them using
    threads::shared