Its all about PYTHON
(Data Science with some fun version.2.1.0)
Search This Blog
Python Chat Application (Client & Server)
WATCH THE TUTORIAL FIRST
client.py
#Start the client secondimportsocket,sys,timex=socket.socket()h_name=input(str("Enter hostname:- "))port=8000x.connect((h_name,port))print("Server Connected...!")print("Let the Server Type First")try:while1:incoming_message=x.recv(1024)incoming_message=incoming_message.decode()print()print("Server said: ",incoming_message)print()message=input(str(">>>> "))message=message.encode()x.send(message)except:print("Server went OFFLINE")
server.py
#Start the server firstimportsocket,sys,timex=socket.socket()h_name=socket.gethostname()print("Your host name is : ",h_name)port=8000x.bind((h_name,port))x.listen(1)connection,address=x.accept()print("Server is ONLINE ! ! !")try:while1:display_mess=input(str(">> "))display_mess=display_mess.encode()connection.send(display_mess)in_message=connection.recv(1024)in_message=in_message.decode()print()print("Client said: ",in_message)print()except:print("Client went OFFLINE")