Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the parameter of 1 mean in `listen(1)` method of socket module in python?

What does the parameter of 1 mean in the listen(1) method of socket. I am using the socket module in python 2.7 and I have created a basic server that I want to connect to multiple clients (all on a local machine) and transmit data between them. I know there a simpler ways of doing this but I want practice for when the clients would not all be on the same machine and may need to retrieve something from the server first so could not bypass it. I was wondering if the 1 in listen referred to the amount of connections the server would make at a single time and if not what it did mean. I really want to understand in detail how parts of the process work so any help would be appreciated.

like image 763
Matt Avatar asked Oct 19 '25 09:10

Matt


1 Answers

It defines the length of the backlog queue, which is the number of incoming connections that have been completed by the TCP/IP stack but not yet accepted by the application.

It has nothing whatsoever to do with the number of concurrent connections that the server can handle.

like image 70
user207421 Avatar answered Oct 22 '25 04:10

user207421



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!