开发者

Writing A Socket Server Application

开发者 https://www.devze.com 2023-01-30 20:47 出处:网络
I have to design a server socket program.The requirement is Each connection from client will be in different threads.

I have to design a server socket program.The requirement is Each connection from client will be in different threads.

The challenge is Suppose Server is now connected with two client Client A and client B.They will be in two different thread.

My application requirement is when serve开发者_如何学Pythonr will get some message from Client A or Client B ,after processing this message it will send the messages to both Client A and client B.

Can you please suggest what will be the right approach for it .How to know what clients are open at a time .


Quite simple really - have data structures shared by the two threads and protected from concurrent access. You can design the sending based on a message queue like pattern.

0

精彩评论

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