Python Network Programming 10 – Multiple Client ( Socket Programming )

In this section we are going to be taking our reverse shell program to the next level. For starters, Previously, we had one server and one client and we connected both of them using a connection object. But what if we wanted to connect to multiple clients? That is, what if we wanted to control more than one computer from our single server?

Right now if you want to have multiple clients you will have to create multiple servers.But that is going to be costly and not every feasible. I’ll take the example of hacker again. Lets say the hacker wants to affect hundreds of computers. Will he make hundreds of servers? Obviously no.

Another example would be, lets say you are a system administrator and you need to have remote access to all computers in the lab or in workstation. In this case too our current reverse shell program won’t work!

So In this video, We will add the functionality of handling all the clients from one single server python file and build the multiple client support system.

Before we get into that, let me explain it to out how it’s going to work. Every time we accept a connection we get back two outputs. First is a connection object and second is the address list. Using the connection object we can send commands to another computer and the address list contains the information like port and IP address.

So what we are going to do is that we are going to create an empty list or you can call it an array of connection objects and address. And every time we connect to client we are going to append it or add it to that list.

Then we can loop through the list of clients connected to our server and choose the one that we want.

So we have write a program that two tasks at once.
1) The first task is to listen and accept connections from other clients and store them in a list
2) The second task is sending commands to an already connected client

But you must be thinking how can we do two tasks from the same program at the same time? This is achieved by a concept known as threading. You can think of threads as a multitasking support system. For example, I am talking to you right now and thinking at the same time. So one of my thread is handling my speaking abilities and the other thread is handling my thinking. In the same way the first thread is going to listen and accept connections from other clients and the second thread is going to handle  connection with an already connected client and send commands

Github Code –
Next Video – Handling Connections
Python Network/Socket Programming Playlist –

Subscribe –
Website –
Instagram –




privacy policy.

Your email will never be shared with a third party. We'll only use it to notify you of our launch and of special events taking place in your city. You'll have the opportunity to unsubscribe at any time, immediately, once you receive your first email.