SPUG: IO::Socket Question
ced at carios2.ca.boeing.com
ced at carios2.ca.boeing.com
Thu Aug 10 00:59:19 CDT 2000
> $sock = IO::Socket::INET->new(
> PeerAddr => "thehost",
> PeerPort => theportnumber,
> Proto => "tcp")
> or die "Error connecting: $@\n";
> $sock->autoflush(1);
> print $sock "Hello\n";
> print <$sock>;
> close ($sock);
> This sends the first "Hello" okay, but hangs waiting for the response. I'm
> assuming it's a buffering problem, but autoflush(1) didn't seem to help.
> Any suggestions for making this work?
The print <$sock> establishes a list context so the socket
read may be blocking trying to read multiple lines.
Not sure if this is relevant in your case but would be
a problem if this were the SMTP for instance.
A fix might be:
print scalar <$sock>;
rgds,
--
Charles DeRykus
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For full traffic, use spug-list for LIST ; otherwise use spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For full traffic, use spug-list for LIST ; otherwise use spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list