El 23/02/18 a les 18:51, Dimitrios Chr. Ioannidis via fpc-pascal ha escrit:
copy the ssockets.pp from <fpc sources>\packages\fcl-net\src dir to
your project dir and add the following line
SetIOTimeout(FIOTimeout);
to Procedure TInetSocket.Connect; like this
fphttpclient already does that before calling connect and it doesn't work.
As Michael said, the socket must be put in non-blocking mode during the
connection. This is how synapse does it (but I see that ssockets has no
provision for toggling between blocking/non-blocking mode):
if FConnectionTimeout > 0 then
begin
// connect in non-blocking mode
b := NonBlockMode;
NonBlockMode := true;
SockCheck(synsock.Connect(FSocket, Sin));
if (FLastError = WSAEINPROGRESS) OR (FLastError = WSAEWOULDBLOCK)
then
if not CanWrite(FConnectionTimeout) then
FLastError := WSAETIMEDOUT;
NonBlockMode := b;
end
else
SockCheck(synsock.Connect(FSocket, Sin));
Bye
--
Luca
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal