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 git@github.com:rohitraut3366/Chat-Application-Using-Socket-Programming-in-python.git

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….:)

Technology Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store