> I think it's not supported, since I added the block below to
TCustomWSocket.Connect
> and receive data just fine though the timeout is set to 1 ms. Or am I
missing
> something?

If not supported, you should receive an error when calling setsockopt whihc
is not the case.
I think the timeout applies only to blocking socket. Using non blocking
socket as ICS does, there is no problem with timeout. You application is
never stuck in a recv call: you only call recv when winsock told you to do
so posting a message which is turned to an OnDataAvailable event by
TWSocket.

Implementing a timeout with async socket is just a matter of testing since
how long you haven't received a read request (OnDataAvailable event) from
the remote site, or a write request (OnSendData), or a connect status
(OnSessionConnected), or a disconnect status (OnSessionClosed) and so on.

I always implemented timemout at the application level using a simple and
single TTimer for all timeouts.

--
[EMAIL PROTECTED]
Auteur du freeware ICS - Internet Component Suite
Auteur du middleware multi-tiers MidWare
http://www.overbyte.be


----- Original Message ----- 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Saturday, April 23, 2005 6:14 PM
Subject: Re: [twsocket] Reasonable timeout


> Francois PIETTE wrote:
> >> I just wonder how other programs can provide a
> >> user defined TCP timeout that appears to overrule the system setting or
> >> is something like that just a fake?
> >
> > I've searched on MSDN and found that setsockopt has those options:
> > SO_RCVTIMEO Receives time-out in milliseconds (available in the
Microsoft
> > implementation of Windows Sockets 2).
> > SO_SNDTIMEO Sends time-out in milliseconds (available in the Microsoft
> > implementation of Windows Sockets 2).
> >
> > Maybe this is what you search for ?
> > The text is not clear is those BSD options are supported or not !
>
> Now I understood the what BSD means :) Berkley Software Distribution or
so,
> the roots of Winsock.
>
> I think it's not supported, since I added the block below to
TCustomWSocket.Connect
> and receive data just fine though the timeout is set to 1 ms. Or am I
missing
> something?
>
>
> { Socket type is SOCK_STREAM }
>
>         optval  := 1;
>         iStatus := WSocket_Synchronized_setsockopt(FHSocket, SOL_SOCKET,
>                                   SO_RCVTIMEO, @optval, SizeOf(optval));
>         if iStatus <> 0 then begin
>             SocketError('setsockopt(SO_RCVTIMEO)');
>             Exit;
>         end;
>
>
> Arno Garrels
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to