Re: [twsocket] WSocketServer stops listening
In TWSocketServer, when an exception occur at the time a client is connecting, maybe in your own event handler code (for example in OnClientConnect event), a BgException is triggered. If you have no handler for this event, the listening socket is aborted (closed) and the exception is silently ignored. If you have a handler, you have the choice of not aborting the socket and keep it listening. Note that depending on what the exception was and where it occured, it is possible that the component is in a strange state. I think it is better to let the abort occur to have the component back to a known state (closed) and make it listen again a few moment later, probably by posting a custom message to the form and from the corressponding event handler making the socket listening again. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "A.Shekar " <[EMAIL PROTECTED]> To: Sent: Saturday, September 10, 2005 7:14 AM Subject: Re: [twsocket] WSocketServer stops listening > Hi Wilfried, > The normal load is 40-60%. In Server BGException i set CanClose := > False. Other info i can check on monday morning. > > regards > Shekar > > -- > 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] WSocketServer stops listening
Hello Shekar, >I check socket state before every PutDataInSendBuffer and Send. > Should i use try except end around these statements ? You should do around Send; > Why should > client error result in listen stopping ? Should not. To debug you should log in OnSessionClosed of the the server. There you post a message over there to let it listening again if it is a 24/7 application. > Does this mean KeepAlive is always ON ? How often is a keepalive > packet transmitted I dont think there is mutch keep alive in windows. If you want to check if connection is still working you have to do a keep aive in the protocol you design. --- Rgds, Wilfried http://www.mestdagh.biz Tuesday, September 13, 2005, 06:30, A.Shekar wrote: > Hi Wilfried, >I check socket state before every PutDataInSendBuffer and Send. > Should i use try except end around these statements ? Why should > client error result in listen stopping ? >In TCustomWSocket.Connect, after SetLingerOption, the following code is > present : > optval := -1; > iStatus := WSocket_Synchronized_setsockopt(FHSocket, SOL_SOCKET, > SO_KEEPALIVE, @optval, SizeOf(optval)); > Does this mean KeepAlive is always ON ? How often is a keepalive packet > transmitted ? > regards > Shekar -- 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] WSocketServer stops listening
Hi Wilfried, I check socket state before every PutDataInSendBuffer and Send. Should i use try except end around these statements ? Why should client error result in listen stopping ? In TCustomWSocket.Connect, after SetLingerOption, the following code is present : optval := -1; iStatus := WSocket_Synchronized_setsockopt(FHSocket, SOL_SOCKET, SO_KEEPALIVE, @optval, SizeOf(optval)); Does this mean KeepAlive is always ON ? How often is a keepalive packet transmitted ? regards Shekar -- 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] WSocketServer stops listening
Hello Shekar, I dont think you can. You should use exception blocks instead OnError to have control over everything. --- Rgds, Wilfried http://www.mestdagh.biz Monday, September 12, 2005, 07:24, A.Shekar wrote: > Hi Wilfried, >The Server.OnError or Server.OnBGException are not triggered. > It is the Client.OnError that is triggered. Where can i get the errorcode > from ? > regards > Shekar -- 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] WSocketServer stops listening
Hi Wilfried, The Server.OnError or Server.OnBGException are not triggered. It is the Client.OnError that is triggered. Where can i get the errorcode from ? regards Shekar -- 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] WSocketServer stops listening
Hello Shekar, I suggest following for a 24/7 server: 1. in OnBGException set CanClose to True 2. in OnSessionClosed post a message to custom message handler that set it to Listen again. And meanwile log all and also the winsock error if any. This way your server will stay running while it does self debugging :) --- Rgds, Wilfried http://www.mestdagh.biz Saturday, September 10, 2005, 07:14, A.Shekar wrote: > Hi Wilfried, >The normal load is 40-60%. In Server BGException i set CanClose > := False. Other info i can check on monday morning. > regards > Shekar -- 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] WSocketServer stops listening
Hi Wilfried, The normal load is 40-60%. In Server BGException i set CanClose := False. Other info i can check on monday morning. regards Shekar -- 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] WSocketServer stops listening
> I have a program with WSocketServer. > This Server just stops listening for new connections. > I do a Server.Close and Server.Listen and then new > connections start coming in. What could be the reason? You say it just stop. No error message, no exception ? About exception are you sure you haven't silently catched exceptions ? I doubt it's the problem, but you have to know wthat passing an invalid handle to CloseHandle may close a socket. Close handle is used by many many features as it is the general close function in windows. So closing something not opened, not correctly initialized, something already freed and so on could result of the listening socket being closed if it happend that the invalid handle value is unfortunately the listening socket handle. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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] WSocketServer stops listening
Hello Shekar, - The CPU time is that a normal load, or is this only after the server has stopped listening ? - Interesting info also is the amount / used non paged memory - and amount / used pool - do you have code in server's OnBGException ? --- Rgds, Wilfried http://www.mestdagh.biz Friday, September 9, 2005, 06:36, A.Shekar wrote: > Hi, > I have a program with WSocketServer. This Server just stops > listening for new connections. I do a Server.Close and Server.Listen > and then new connections start coming in. What could be the reason? > Some info which might be useful to understand the situation. > 1. 300 to 800 may be connected when the problem happens. > 2. Each connection gets 2000 - 4000 bytes per second from the > server. The server may receive 100 bytes from the client once in > while. The application runs for about 6 hours. > 3. 10-20 new connections may be requested simultaneously sometimes. > 4. The CPU usage is 40-60%. > (Some time back the CPU usage used to reach 100%. At that time i > faced the same problem. I optimised the code and usage came below 10% > and the problem vanished) > 5. The software runs on W2K Server. WSocketServer.ConnectionBacklog is 200 . > 6. WSocket V5.16, Single threaded application > regards > Shekar -- 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