You are not logged in.
Pages: 1
tcp := TCrtSocket.Open(RawByteString(aServer), RawByteString(IntToStr(FPort)));
if tcp <> nil then begin
try
tcp.ReceiveTimeout := 5 * 1000;
tcp.CreateSockIn;
tcp.CreateSockOut;
Writeln(tcp.SockOut^, aCommand);
aRawData := tcp.SockReceiveString; // Never come back sometimes
Result := string(aRawData).Trim;
except
on E: Exception do
LogException(E, Format('Command: %s - TWhoisQuery.SendCommand()', [aCommand]));
end;
FreeAndNil(tcp);
end;
Up codes, SockReceiveString with comment has a problem, it never come back sometimes.
Offline
Is there a bug in SO_RCVTIMEO?
Offline
In fact, we never use SockReceiveString method in our code base.
This method sounds unsafe to use.
You should better call CreateSockIn, then use Readln(SockIn,s) to read a line from the opened socket.
Or call directly the SockRecvLn() method or TCrtSocket.TrySockRecv() if you do not call CreateSockIn.
Offline
Pages: 1