Re: [twsocket] Reasonable timeout
As I said before, it is not clear. MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/setsockopt_2.asp) says those BSD options are not available but a few lines later they say it is available in the Microsoft implementation of Windows Sockets 2. My interpretation is that winsock 1 doesn't implement it at all and winsock 2, implemented by Microsoft support them. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "Piotr Hellrayzer Da³ek" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Sunday, April 24, 2005 1:00 AM Subject: Re: [twsocket] Reasonable timeout > Hello! > > > 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? > > You guys probably forgot about Win32 API Help shipped with Delphi. There's > clearly noted: > > #v+ > BSD options not supported for setsockopt are: > > Value Type Meaning > SO_ACCEPTCONN BOOLSocket is listening > SO_RCVLOWAT int Receive low water mark > SO_RCVTIMEO int Receive time-out > SO_SNDLOWAT int Send low water mark > SO_SNDTIMEO int Send time-out > SO_TYPE int Type of the socket > #v- > > Current Win32 API Help file documents Winsock 2 (Windows Sockets 2), and > as far as I know Microsloth, they didn't even attempted to implement these > options. > > -- > Piotr "Hellrayzer" Dalek > Author of ICS-Based Hellcore Mailer - an Outlook Express killer > http://www.hcm.prv.pl > [EMAIL PROTECTED] > > > --- > Twoja komorka wymaga wzmocnienia? > Sciagnij tapete z najwiekszym silaczem. > Tutaj >> http://link.interia.pl/f1876 << > > > -- > 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
Re: [twsocket] Reasonable timeout
Hello! > 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? You guys probably forgot about Win32 API Help shipped with Delphi. There's clearly noted: #v+ BSD options not supported for setsockopt are: Value TypeMeaning SO_ACCEPTCONN BOOLSocket is listening SO_RCVLOWAT int Receive low water mark SO_RCVTIMEO int Receive time-out SO_SNDLOWAT int Send low water mark SO_SNDTIMEO int Send time-out SO_TYPE int Type of the socket #v- Current Win32 API Help file documents Winsock 2 (Windows Sockets 2), and as far as I know Microsloth, they didn't even attempted to implement these options. -- Piotr "Hellrayzer" Dalek Author of ICS-Based Hellcore Mailer - an Outlook Express killer http://www.hcm.prv.pl [EMAIL PROTECTED] --- Twoja komorka wymaga wzmocnienia? Sciagnij tapete z najwiekszym silaczem. Tutaj >> http://link.interia.pl/f1876 << -- 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
Re: [twsocket] Reasonable timeout
> 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" 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
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
Re: [twsocket] Reasonable timeout
Dan wrote: > I've had servers that take slightly more than 60 seconds to establish the > connection, but once connected they work fine (no lag). OK, the best would be to deligate timeout setting to the user, as Wilfried wrote. > maybe its only possible for > blocking sockets, I don't think so, since I'm running a non-blocking mail server that provides user defined TCP timeout settings as well. > but someone could check their sourcecode and see what > they do. I'll have a look at it. Arno Garrels > - Original Message - > From: "Arno Garrels" <[EMAIL PROTECTED]> > To: "ICS support mailing" > Sent: Saturday, April 23, 2005 7:22 AM > Subject: Re: [twsocket] Reasonable timeout > > > Thanks Wilfried, > ... > My opinion was (and still is) that if I don't get a response after > 30-50 sec it's useless to wait any longer since either the line is too > bad or a server is too busy to finish a transaction successfully either. > But I'll make it like you said and will satisfy them by a little spinedit > to play with ;) > > 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
Re: [twsocket] Reasonable timeout
I've had servers that take slightly more than 60 seconds to establish the connection, but once connected they work fine (no lag). It was because it was trying to do a reverse dns lookup and there was something wrong with the dns coniguration, but still, it can happen. As for other products overriding the system default, Im not sure, but I think Indy can have a user-defined timeout...maybe its only possible for blocking sockets, but someone could check their sourcecode and see what they do. Dan - Original Message - From: "Arno Garrels" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Saturday, April 23, 2005 7:22 AM Subject: Re: [twsocket] Reasonable timeout Thanks Wilfried, ... My opinion was (and still is) that if I don't get a response after 30-50 sec it's useless to wait any longer since either the line is too bad or a server is too busy to finish a transaction successfully either. But I'll make it like you said and will satisfy them by a little spinedit to play with ;) 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
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 ? Probably yes. But they say not much about SO_RCVTIMEO. "SO_RCVTIMEO and SO_SNDTIMEO When using the recv function, if no data arrives during the period specified in SO_RCVTIMEO, the recv function completes. In Windows versions prior to Windows 2000, any data received subsequently fails with WSAETIMEDOUT. In Windows 2000 and later, if no data arrives within the period specified in SO_RCVTIMEO the recv function returns WSAETIMEDOUT, and if data is received, recv returns SUCCESS." Hmm, that's a bit confusing concerning the win-versions (wasn't WS 2 available on NT4 as well?). > The text is not clear is those BSD options are supported or not ! If you mean "supported or not by different OS" I agree, unless this won't be totaly clear I won't use it. However it appears that those options could be used to substitute own timeout implementations completely, correct? 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
Re: [twsocket] Reasonable timeout
> 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 ! -- [EMAIL PROTECTED] 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
Re: [twsocket] Reasonable timeout
Thanks Wilfried, >> 2. How can I catch and handle a system TCP timeout in ICS? and > > You will get the 10060 (conn timed out) as error argument in the > TWSocket events. Good to know, that's easy enough to handle. >> 1. How do I find the actual system TCP timeout? > > Dont know, somewhere in registry I suppose. I _think_ we have a FAQ but > I cannot search at moment. I recall that we had a discussion in this list a while ago, but there seems to be nothing in FAQ yet. 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? >> 3. Isn't 30-50 seconds enough even on very bad lines? > > Should be. However I mostly make it user defined in file | parmeters > with a default of 15..60 sec's depending if it is a connection trough > LAN - routers between 2 LAN - internet. My opinion was (and still is) that if I don't get a response after 30-50 sec it's useless to wait any longer since either the line is too bad or a server is too busy to finish a transaction successfully either. But I'll make it like you said and will satisfy them by a little spinedit to play with ;) Arno Garrels > --- > Rgds, Wilfried > http://www.mestdagh.biz > > Friday, April 22, 2005, 20:03, Arno Garrels wrote: > >> Hello, > >> Actually I have a custom timeout in all of my applications which >> is hardcoded to values between 30-50 seconds. It's that short because >> I do not want the system timeout hit in my program flow. >> But now users want the timeout user defined and longer :(. > >> So my questions are: >> 1. How do I find the actual system TCP timeout? >> 2. How can I catch and handle a system TCP timeout in ICS? and >> 3. Isn't 30-50 seconds enough even on very bad lines? > >> Thanks in advance, > >> 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
Re: [twsocket] Reasonable timeout
Hello Arno, > 2. How can I catch and handle a system TCP timeout in ICS? and You will get the 10060 (conn timed out) as error argument in the TWSocket events. > 1. How do I find the actual system TCP timeout? Dont know, somewhere in registry I suppose. I _think_ we have a FAQ but I cannot search at moment. > 3. Isn't 30-50 seconds enough even on very bad lines? Should be. However I mostly make it user defined in file | parmeters with a default of 15..60 sec's depending if it is a connection trough LAN - routers between 2 LAN - internet. --- Rgds, Wilfried http://www.mestdagh.biz Friday, April 22, 2005, 20:03, Arno Garrels wrote: > Hello, > Actually I have a custom timeout in all of my applications which > is hardcoded to values between 30-50 seconds. It's that short because > I do not want the system timeout hit in my program flow. > But now users want the timeout user defined and longer :(. > So my questions are: > 1. How do I find the actual system TCP timeout? > 2. How can I catch and handle a system TCP timeout in ICS? and > 3. Isn't 30-50 seconds enough even on very bad lines? > Thanks in advance, > 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