Chat Servers Using Multi-threading

Chat Servers

Requirements

Two Operating Systems to act as Client Server and Host Server. These severs be fed with a python code to communicate with each other. Using the concept of multi-threading, the python code runs simultaneously in both the systems.

Code

import socket
import threading
import os

s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)

ip = “13.126.199.236”
port = 3000
s.bind( (ip,port) )

def t():
while True:
msg=input()
s.sendto(msg.encode(),(“13.126.199.236”,3000))
x=s.recvfrom(1024)
data=x[0]
print(“linux : “+data.decode())

t1 = threading.Thread(target = t)
t2 = threading.Thread(target = t)
t3 = threading.Thread(target = t)
t1.start()
t2.start()
t3.start()

Visit https://github.com/abhiroopbasak/python/blob/master/chat_server for more information.

client side
server side

Thank you for reading!

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Dashboard Tutorial (I): Flask and Chart.js

Did you study Liberal Arts in college? Believe it or not, you can become the next programming star!

Accessibility testing vs Cypress

Pandas Dataframe Feature Deep Dive

Download In *PDF C# 7.0 All-in-One For Dummies Read ^book &ePub

KUBERNETES Succesfull usecase stories

Articulate 1.0 Release

Open ID Connect, OAuth and What Does It Mean?

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
Abhiroop Bas

Abhiroop Bas

More from Medium

Getting started with Redis

How to Build Linux ARM32 and Aarch64 Barcode QR Scanner in Docker Container

Using SCSS/SASS with Django3

Django Image

What is BackEnd?