http://www.perlmonks.org?node_id=986590


in reply to Re: Problem Transmitting Data via TCP/IP
in thread Problem Transmitting Data via TCP/IP

Thank you! I knew it had to be something simple like that.

But what do you mean "wrongly coded"? How should htonl() be defined?

When I change my code to this:

# $socket->send( htonl($request_length) ) or die "3a Couldn't write + to socket: $!"; $socket->send( pack('l>',$request_length) ) or die "3a Couldn't wr +ite to socket: $!"; $socket->send( $request ) or die "3b Couldn't write to socket: $!" +;

I get the expected output in the logging console, and the server seems to write the response to the socket, but my client fails to read the response from the socket.

I get this message now:

5 Couldn't read data from server:

So something is still not quiet right... but I'm getting closer!