> What would be the safer way to implement this shutdown? Should the > server call a DisconnectAll, or should the server send a message to the > client, and wait till all the clients are offline.
Your server can gracefully close any client connection by calling Shutdown. The server must implement some timeout because some client may not respond and so must be force close by calling Abort. Beside that, if you need it, you can send a message to your clients asking them to disconnect gracefully. Selecting one method depends on your preference and need. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be ----- Original Message ----- From: "Clément Doss" <[EMAIL PROTECTED]> To: "ICS support mailing" <[email protected]> Sent: Monday, May 05, 2008 7:52 PM Subject: [twsocket] Notifying clients that TWSocketThrdServer is shuttingdown Hi, I'm working on a project (Delphi 7, and ICS V5). I built a server using TWSocketThrdServer and the clients are derived from TWSocketThrdClient. Here is the code: TTaskClientTCP = Class( TWSocketThrdClient ) public Buffer : String; ConnectTime : TDateTime; end; procedure TTaskServerTCP.Internal_ClientCreated(Sender: TObject; Client: TWSocketClient); begin Client.OnDataAvailable := InternalEvent_ClientDataReceived; end; procedure TTaskServerTCP.Internal_ClientConnected(Sender: TObject; Client: TWSocketClient; ErrCode : Word); begin TTaskClientTCP(Client).ConnectTime := now; end; procedure TTaskServerTCP.InternalEvent_ClientDataReceived(Sender: TObject; ErrCode: Word); begin if ErrCode = 0 then begin TTaskClientTCP( Sender ).Buffer := TTaskClientTCP( Sender ).ReceiveStr; Internal_ProcessClientData(TTaskClientTCP( Sender ) ); end; end; two situations might happen: 1) Administrator must shutdown the server. During this shutdown I would like to send a msg to all clients and disconnect them "gracefully". 2) A specific client software that is used by a single "power user" can request a server "restart". I would like to send a command to all the clients that a restart has been requested. The restart should disconnect all clients, wait a few seconds, and reconnect again. In my current implementation, this is still not implemented. If the server shuts down with live clients, bad things happens to the client side. The only option, is to disconnect all the clients (one by one), then disconnect the server. If the latter is done, the application can be used without any problems. What would be the safer way to implement this shutdown? Should the server call a DisconnectAll, or should the server send a message to the client, and wait till all the clients are offline. Is there any sample of such procedure? Best regards, Clément -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
