![]() ![]() It's very well worth writing code in a way that's easy to read. This code is barely readable, due to all the single-letter variable names in the most important controlling logic of the program.įocusing on write-time convenience is a false economy:Ĭode is read far more often than written. I don't know if this way is was too kind to you about variable names. Program uses dictionary and lists for send message to particular client. With this code every user can send and recive messages.įor example if there are 2 users (2 clients with server active): max and paul if max writes paul>hello paul recives max>hello. S = socket.socket(socket.AF_INET, socket.SOCK_STREAM) This is my code for client: import socket ![]() It's only for study purpose, I'd like understand the logic behind a simple private chat with socket and the best mode to implement it with no framework.įor now, It's not important to check for example if username has > or other, only socket procedure and send messages to specific client. I try to create a private chat with Python but I don't know best practice.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |