----- Original Message -----
From: "Theocharous, Amrit" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 4:53 AM
Subject: Port listener problem


>
> -----Original Message-----
> From: Theocharous, Amrit
> Sent: 27 September 2002 09:51
> To: [EMAIL PROTECTED]
> Subject:
>
>
>
> All,
>
> Can't see to get this right.....
>
>
>
> # Connect to my port... Works fine!
>
> $ClientSocket = new IO::Socket::INET (
>
> PeerAddr => '166.12.121.47',
>
> PeerPort => $SendPort,
>
> Proto => 'tcp')
>
> or &CGIError ("Could not connect to Unix distribution server: $!\n");
>
> # Send the information...
>
> $ClientSocket -> send ("$HostName $ReleaseRoot");
>
> # Set up some code to get the loop rolling...
>
> $ReturnMessage = "X";
>
> $TotalString = "";
>
> # Now we run the loop. This is working fine, reads in all the data,
>
> # but then hangs on the 'recv' function. The problem is that I need a
>
> # way to read any amount of information back from the port. HELP!
>
> while ($ReturnMessage ne '')
>
> {
>
> $ClientSocket -> recv ($ReturnMessage, 4096);
>
> $TotalString .= $ReturnMessage;

recv() is typically used with UDP sockets. But in any case, recv() will
block until the server sends more data or closes the remote end of the
connection. Unless the server does that, how do you know you've read all the
data? Does the application level protocol implement some kind of message
terminator, or does it indicate how many bytes are to be received?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to