in reply to Converting Java Sockets to Perl Sockets

You're probably sending the right data (you could confirm this with a packet sniff of the Java and Perl sessions; but your error is probably in the reading back part: <$socket> will attempt to read a line of data from the socket; if the returned data isn't character based (which is probably isn't), then this is likely to hang waiting for a \n character. Instead, you need to look at the Java code that does the reading back, and determine what it is expecting, then read that number of bytes in.

For example the server might return 2 bytes indicating the length, followed by that many bytes of data. That could be read using

my $buf; read($socket, $buf,2); my $len = unpack 'n', $buf; read($socket, $buf, $len);