Creating a Chat Server Program using Socket Programming by creating both Server and Client machine as Sender and Receiver both using UDP Data Transfer Protocol, On top of that using multi-threading concept to get and receive data parallelly from both the Server Sides.

Machines used have different OS like One Linux Machine and One Windows. Both machines is configured with python.

Prasantmahato
3 min readJan 9, 2021

--

In Chat Server Program ,

I have used two modules

import socket

import threading

I have created two dictionary for using multithreading on that two dictionaries created for the dictionary to run parallel.

def sender()

In this dictionary ,

In while loop, I have a created a socket program that would receive 1024 bytes of the packets from the sender and then decode that binary and print the output .

def receiver()

In this dictionary ,

In while loop, I have a created a socket program that would first encode the input in binary and then send the packets to the receiver.

Now I created two threads ,

t1 and t2

Then I started the thread parallel .

Here is My ,

Window’s Ip is : 192.168.0.105

Port no used : 8081

Linux IP is : 192.168.0.107

Port no used : 1234

This Program I created in Windows OS machine.

This Program I created in Linux OS machine too.

Here, We get an Output after running the Program.

Now, Observing the challenges that I face to achieve this using UDP.

Here We can see ,

If We are sending the packets from Windows OS using UDP protocol you can see it keeps on sending the packets and is not waiting for any reply from the Linux OS .

Same If I do with Linux OS , We can see the same problem arises .

This is What the issue with UDP protocol ,In this Practical If we use TCP protocol ,It will work better .

THANKYOU

OPEN FOR ANY QUERIES AND SUGGESTIONS .

--

--