in reply to IO::Socket::INET, threads, and screwy recv() results

The problem is that both threads have a copy of $sock, and each one will close() it when they exit. You're trying to dup() the socket to stop that, but why not set $sock as shared?

Replies are listed 'Best First'.
Re^2: IO::Socket::INET (dup?)
by castaway (Parson) on Jan 05, 2006 at 10:45 UTC
    Because you can't share blessed objects between threads.

    C.

Re^2: IO::Socket::INET (dup?)
by jettero (Monsignor) on Jan 04, 2006 at 13:07 UTC
    That is most definitely not the problem actually. If you look closely, neither thread exits at all. The join() blocks until the threads finish so you have to SIGINT your way past the joins to close the socket.

    Also, you can't my $sock : shared. I tried that. It generates a "stupid type to share" error or something like that.

    Anyway ... Thanks for you input. I actually did try the things you suggested.