idealbad.blogg.se

Multi chat client thread client or server
Multi chat client thread client or server










multi chat client thread client or server

More pedanticly, it needn’t: serious chat services often do things like The client connects, but doesn’t know about any other clients. Is it a variable that’s going to be in the client’s script? Yes, but again it is a made up name you’ll have to obtain it in your But the work all happens in the server.Īnd what about my_socket? Is it identified as one of the threads opened

multi chat client thread client or server

Yes, but they’re just made up variable names.

multi chat client thread client or server

These variables, the_client_sockets and client_socket are handled by Of these and use it to decide which client to skip when copying theĬameron Simpson I have a couple of questions. Msg_flags, address).” The “address” is the client address - keep a list Instead you probably receive messages with socket.recvmsg(), whichįrom the docs: “The return value is a 4-tuple: (data, ancdata, Socket accepting UDP datagrams from clients there’s no connection If you’re using datagrams (usually UDP packets) where you have a server Just record the socket in “the_client_sockets” when the server That works if your chat server is using stream (usually TCPĬonnections), where there’s a stable “connection” socket for eachĬlient. the socket you're using when you receive the message You can see ifĪ reference to a socket is a particular reference with Python’s “is” Requirement, but: every connection is a “socket” object. Keep an array of the active sockets, copy to every socket if that socket If you’re just exchanging messages (receive message, copy to every But a socket knows what it talks to at an IP That’s becauseneither socket nor threading track clients of higher level












Multi chat client thread client or server