How to set Send timeout?

Giganews Newsgroups
Subject: How to set Send timeout?
Posted by:  Jan Derk (no…@none.none)
Date: Fri, 26 Aug 2005

I am testing the latest Indy 10 development snapshot version for the
influence of abnormal disconnections on TidFTP. The number of
routers/firewalls dropping connections during long transfers because
they think it is idle seems on the rise.

The problem is that TidFTP does not return until a socket timeout has
appeared. One place where TidFTP would hang is in
TIdIOHandler.ReadLnWait. Luckily the code posted in the topic below
helped me out.

Another problem occurs when writing data. FTP hangs when writing to a
socket on line 508 in idStackWindow.pas:

function TIdStackWindows.WSSend(ASocket: TIdStackSocketHandle;
  const ABuffer; const ABufferLength, AFlags: Integer): Integer;
begin
  Result := CheckForSocketError(IdWinsock2.Send(ASocket, ABuffer,
ABufferLength , AFlags));
end;

IdWinsock2.Send() only returns after the socket has timed out, which
generally takes a minute or longer.

Probably I am overlooking something but I could not find a way to set
the winsock send timeout value in Indy. From the winsock documentation
it seems that a send time-out can be set using SO_SNDTIMEO option in
the setsockopt() function.

Is there an easy way to set the send time-out in Indy 10?

Or is there another way to reduce the send time-out value when sending
data using TidFTP?

Jan Derk

Replies