Chatting Application using Python

Karan Agrawal
3 min readJan 12, 2021

Task Description 👨🏻‍💻

  • Create your own Chat Servers, and establish a network to transfer data using Socket Programing by creating both Server and Client machine as Sender and Receiver both. Do this program using UDP data transfer protocol.
  • Use multi-threading concept to get and receive data parallelly from both the Server Sides. Observe the challenges that you face to achieve this using UDP.

Note: Machines must have different OS like One Linux Machine one Windows. Both machines must be configured with python.

So I have used two OS, one Redhat Linux and the second is Windows.

  • Redhat OS whose ip is 192.168.29.121 is serving as a client. I named it Chirag’s Chat.
Redhat
  • Windows whose ip is 192.168.29.223 is serving as a server. I named it Karan’s Chat.
Windows

So in the below image, there are two programs named client.py and server.py in Redhat and Windows respectively.

This is the code of client-side, i.e, on the side of Chirag:

This is the code of server-side, i.e, on the side of Karan:

After running these two programs, as they are running on UDP, they will ask each other’s IP:

So these two systems are ready to chat!!!!

So at last there is the chat between the two friends:

This program will automatically end when both users will say ‘bye’.

You can find the code here.

--

--