After the server socket receives the connection, calling accept will generate a new socket object used to communicate with the client. So the server only needs to keep the two socket objects of you and your friend. For example, s1 and s2. Then when the server receives the message from s1. The server then sends it to your friend through s2. This is my idea, I haven’t tried it myself. You can refer to it.
After the server socket receives the connection, calling accept will generate a new socket object used to communicate with the client. So the server only needs to keep the two socket objects of you and your friend. For example, s1 and s2. Then when the server receives the message from s1. The server then sends it to your friend through s2.
This is my idea, I haven’t tried it myself. You can refer to it.
Tornado officially has chatroom examples, chatroom demo
There is also code interpretation on SF