开发者

Socket Server: Manage client connections

开发者 https://www.devze.com 2022-12-17 06:24 出处:网络
I\'m wondering how to implement a client management for a socket server. I\'m having the case where I would like to know whether the client has just reconnected or if it\'s a new client. I know, it s

I'm wondering how to implement a client management for a socket server.

I'm having the case where I would like to know whether the client has just reconnected or if it's a new client. I know, it shouldn't be that way. It's a r开发者_运维知识库ather temporarily server, though, which is only to be used for a couple of hours.

I was thinking about letting every client pass its own GUID to the server. Once the server "recognizes" a client, it can get rid of the previous-held connections of that client.

How would you approach this issue? Or is it completely unapproriate this way?

Thank you!


If you are using TCP/IP, than you can use IP addres and port to uniquly identify clients. And you can get rid of your connection after disconnect event. If IP address and port is not enough to uniquly identify client, than you can use GUID. And again with TCP/IP in many cases you can get rid from connection after disconnect event.

0

精彩评论

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

关注公众号