|Pathologically Eclectic Rubbish Lister|
IO::Socket vs. Socket vs. off-the-shelf telnetby adamsj (Hermit)
|on Aug 12, 2001 at 21:57 UTC||Need Help??|
adamsj has asked for the
wisdom of the Perl Monks concerning the following question:
So there I was, happily working my way through Lincoln Stein's new book, when something decided not to work as advertised. I've played with it for quite some time now, and as the book's web site is down, I thought I'd come here and ask for advice.
Stein gives code, which I followed fairly closely, for echo clients and servers, each implemented once with Socket and once with IO::Socket. The Socket implementations worked fine. Then I tried the IO::Socket client implementation, which worked fine against the Socket server. However, neither client worked against the IO::Socket implementation--it looks like a deadlock condition. Finally, just for grins, I telneted directly to the server, and lost the deadlock--the text came right back.
I'm finding this pretty puzzling--I've tried various things, including explicitly setting autoflush on (yes, I know it's on be default, but wotthehell). I'm not getting any success. Any thoughts? I'm using current versions from ActiveState Build 628 on Windows ME. Code snippets follow:
Here's the Socket server code:
This works fine. Now, here's the IO::Socket server code:
Here's some of the client code, Socket version:
They laughed at Joan of Arc, but she went right ahead and built it. --Gracie Allen
Edited 2001-08-12 by Ovid.