Python Chat Application

Socket Programming using Python

From Google

In this article, we will create a chat program by using python socket programming and Multi-Threading.

đź”… Create your own Chat UDP Servers, and establish a network to transfer data using Socket Programing by creating both Server and Client machines as Sender and Receiver both.

đź”… Use multi-threading concept to get and receive data parallelly from both the Server Sides.

  1. We need two systems. Both will act as client and server.
  2. As it's a python program, we need a python interpreter to run it.

IP with the port number is known as a socket. It is used for bi-directional communication between two systems. This communication is done via ports that we attached while creating the socket program.

A thread is a sub-process that runs a set task independent of others. So every time a user connects to some server, the server creates a thread for the request.

Step 1: Download the code from the repository in both the system

git clone

Step 2: Check the IP address of both systems

CMD: ifconfig

here we need two modules socket and threading.

The socket has a socket function that helps us to define the type of protocol and type of IP.

socket.SOCK_DGRAM --> used to defind UDP protocol
socket.AF_INET--> There are multiple IP address families eg IPV4, IPV6. AF_INET is used to set IPV4.
send_to --> used to send data to ipPort[tuple having (address,port)]

Threading has a Thread function that takes the name of the function as a target. Help to run two functionality in parallel.

Thank you for reading….:)

Aspiring Cloud DevOps Engineer