Board index » delphi » Closing Server Client Connections without Closing Server Socket.
carlos
![]() Delphi Developer |
Sun, 07 Aug 2005 03:28:55 GMT
|
carlos
![]() Delphi Developer |
Sun, 07 Aug 2005 03:28:55 GMT
Closing Server Client Connections without Closing Server Socket.
I'm trying to close all active client connections to a Server Socket (not
indy, Delphi Sockets). I use the following procedure which closes the clients but the server stills shows them as acctive connections i.e ServerSocket.ActiveConnections does not change. procedure TCommServer.CloseAllConnections; The procedure disconnects the Clients but does not reflect this in the Thanks, Carlos |
Andy M
![]() Delphi Developer |
Sun, 07 Aug 2005 05:33:45 GMT
Re:Closing Server Client Connections without Closing Server Socket.QuoteOn Tue, 18 Feb 2003 19:28:55 -0000, "carlos" <nore...@here.com> wrote: Give them some time to close properly. A graceful disconnect requires some data exchange, and in non-blocking mode, this is done in the background, i.e. calling close starts the process, but when close returns it is still going on. Check the OnClientDisconnect event that should get fired eventually... Andy |
carlo
![]() Delphi Developer |
Sun, 07 Aug 2005 23:08:49 GMT
Re:Closing Server Client Connections without Closing Server Socket.Yes, I do check the OnClientDisconnect Events and they are being called at both ends. The Sockets are getting disconnected but the ActiveConnections property is not changing. I am now assuming it is a buggy scktcmp unit as I followed the Socket.Close procedure and at the end it just removes the socket from a TList property where the ActiveConnections property is also getting it's value. From Delphi docs it states that a TList moves items down in the list If it is true that the TList moves items down when they are removed, then Help !!! Quote"Andy M." <[no-spam]andy.mail...@gmx.net> wrote in message Quote> On Tue, 18 Feb 2003 19:28:55 -0000, "carlos" <nore...@here.com> wrote: |
Andy M
![]() Delphi Developer |
Mon, 08 Aug 2005 00:00:47 GMT
Re:Closing Server Client Connections without Closing Server Socket.QuoteOn Wed, 19 Feb 2003 15:08:49 -0000, "carlos" <nore...@here.com> wrote: Looking at your original code, you should get problems anyway. I didn't look very closely the first time, but now I noticed the for-loop. You should use a while loop in this case, or simply do as you suggested and always close the [0] connection. Because, if things would have worked out as you expected, you would have gotten an AV, since the loop var will be out of the bounds of .Connections somewherer during the loop. Try. While Server.Socket.ActiveConnections > 0 do instead. Andy |
carlo
![]() Delphi Developer |
Mon, 08 Aug 2005 03:37:00 GMT
Re:Closing Server Client Connections without Closing Server Socket.Thanks Andy, but the while loop just freezes the application after closing the first connection[0]. I've now concluded that it is not possible to close all clients in a Thanks for help but I'm going to have use an alternate method of Quote"Andy M." <[no-spam]andy.mail...@gmx.net> wrote in message Quote> On Wed, 19 Feb 2003 15:08:49 -0000, "carlos" <nore...@here.com> wrote: |
1. Socket Server problem: Close socket in TNMGeneralServer
2. Cloud the server close a client connection?
3. Special care when a socket server will close?
4. SQL Server Socket Closing in error
5. Closing server without getting getting prompt
6. Closing server without getting prompt
7. Closing TCP server while clients connected
8. Cannot close ADO connection to detach DB, SQL Server 2000