I have a DatasnapXE client server application using TCP/IP. Server broadcast messages to the clients using TDSServer.broadcastmessage If it happens th开发者_Python百科at a user is not available anymore for some reason, DSServer fires an OnError event.
In the OnError I can't figure it out how to determine which user is down? Is it posslible at all?
Best regards, Kiril Hadjiev
There is no easy/obvious/built-in way of determining this in XE. You could implement something to accomplish this, but it may not be as elegant as you want. For example, you could have the server query all connected clients and have them reply to say they are still there. Process of elimination would lead you to the disconnected client.
One of the main issues is that with XE there was a bug which prevented session management from working with TCP connections. Otherwise, you may be able to navigate the active sessions (which can contain user/client information) to see which ones are missing.
Also, XE didn't have support for TCP Keep-Alive settings, which are useful in situations where TCP connections are severed (network cable unplugged, for example,) but remain in an open state. Without Keep-Alive, you only know the client is gone when you try to write them something.
You may find in a future release of RAD Studio/DataSnap that the features you want for easily accomplishing this are available.
Mat
精彩评论