Last active
July 29, 2020 09:03
-
-
Save PratyushMishra02/b3242b9b72194effa41b8b8fbe0a09fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import sys | |
import time | |
s=socket.socket() | |
host=socket.gethostname() | |
print("Server will start on host:",host) | |
port=1234 | |
s.bind((host,port)) | |
print("Server is bound successfully") | |
s.listen(1) | |
conn,addr=s.accept() | |
print(addr,"has connected") | |
while 1: | |
message=input(str("You:>>")) | |
message=message.encode() | |
conn.send(message) | |
incoming_message=conn.recv(1024) | |
incoming_message=incoming_message.decode() | |
print("Client:>>",incoming_message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just open host and copy your name, paste it on another server and start chatting : ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import sys | |
import time | |
s=socket.socket() | |
host=socket.gethostname() | |
print("Server will start on host:",host) | |
port=1234 | |
s.bind((host,port)) | |
print("Server is bound successfully") | |
s.listen(1) | |
conn,addr=s.accept() | |
print(addr,"has connected") | |
while 1: | |
message=input(str("You:>>")) | |
message=message.encode() | |
conn.send(message) | |
incoming_message=conn.recv(1024) | |
incoming_message=incoming_message.decode() | |
print("Client:>>",incoming_message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment