in reply to Converting Java Sockets to Perl Sockets

Try to syswrite to socket instead of printing to it, or at least do $socket->autoflush(1). That way you'll know you're not suffering from buffering.

And just for the first test, snoop what the java client is sending, construct a string that matches that exactly (using the \xhh notation), and send that. Yes, it's not maintainable, but it will limit the number of things you're trying to debug at the same time.

  • Comment on Re: Converting Java Sockets to Perl Sockets

Replies are listed 'Best First'.
Re^2: Converting Java Sockets to Perl Sockets
by tye (Sage) on May 13, 2004 at 15:33 UTC

    While your advice won't hurt, I doubt it will solve the problem. Sockets are unbuffered by default so neither of your suggestions should matter.

    However, trying to use <$socket> is very often a problem. It will not return, no matter how long you wait, unless $/ ("\n") or end-of-file arrives on the socket.

    Switching to using read or sysread or even recv will likely fix the problem.

    - tye