Python Forum

Full Version: Python's socket library to implement a simple TCP server and client that communicate
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hii community,
I'm working on a project where I need to set up a basic TCP server and client using Python's socket library. The server should listen for incoming connections on a specified port and handle multiple clients, while the client should connect to the and send/receive data. This is the problem iam facing ,give me any suggestions regards this,Thank you. https://19216801.pro/
I think every document I've seen about Python sockets shows how to write a client and a server, so either you have a question about some detail, or this is really lazy attempt to have someone do your homework. Do you have a question?
There is more than one way to solve it. I prefer asyncio. If you start learning socket programming, you should use the low-level sockets in the first place. Then you can learn how to handle multiple connections with Threads. After this, you learn, why threaded network programming is bad.

Then you should learn more about select, which tells you if a socket is ready to receive or send data. Then the next step is the modules selectors, which has a better abstraction.

This opens the door to understand how asyncio works in the deepest level.