开发者

how to know if a client is alive or not

i have a client-server app and i wish to know how can i find out if my client is alive or not ? I was thinking of sending a package from my client especially for this every (lets say) 1 minute and if 开发者_Python百科my server doesn't receive notice of that package in 1 minute, it closes that client connection .

I also saw (both client and server are locally for this test ) that if a client is connected to the server and i end that process ( via task manager ) my server breaks for that connection (actually it is surrounded by a try catch so it closes the connection after that ) . Can i use this ? how often does the server check the stream to see if the client is connected ?


Without knowing any detail on your system's architecture and number of clients, it is usually not recommended for server to contact client for various reasons (Firewall, security, ...) so this is normally achieved by a "heartbeat" from the client.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜