Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Asynchronous Chat Server
- ##Waterlgndx
- ##Chat Server Code based on the first 2 youtube videos posted by SolidShellSecurity :
- ## https://www.youtube.com/watch?v=qELZAi4yra8
- ## https://www.youtube.com/watch?v=Dip7_U12_uU
- ## I'm using Python3.4.1 on Windows 7.
- from socket import *
- HOST = 'localhost' #in order to get the client to work host had to be filled in,
- # this is here for consistency
- PORT = 6014
- s = socket(AF_INET, SOCK_STREAM)
- s.bind((HOST, PORT))
- s.listen(1)
- conn, addr = s.accept()
- while True:
- data = conn.recv(1024)
- print("Received ", data.decode('UTF-8'))
- reply = input("Reply:" )
- conn.sendall(bytes(reply, 'UTF-8'))
- conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement