Advertisement
waterlgndx

Asynchronous Chat Client Python3.4.1

Sep 21st, 2014
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. ##Asynchronous Chat Client
  2. ##Waterlgndx
  3.  
  4. ##Chat Client Code based on the first 2 youtube videos posted by SolidShellSecurity :
  5. ##    https://www.youtube.com/watch?v=qELZAi4yra8
  6. ##    https://www.youtube.com/watch?v=Dip7_U12_uU
  7.  
  8. ## I'm using Python3.4.1 on Windows 7.
  9. from socket import *
  10.  
  11. HOST = 'localhost'              #in order to get the client to work host had to be filled in
  12. PORT=6014
  13. s = socket(AF_INET,SOCK_STREAM)
  14. s.connect((HOST,PORT))
  15. while True:
  16.     message = input("Message : ")
  17.     s.send(bytes(message, 'UTF-8'))
  18.     print ("Awaiting reply")
  19.     reply = s.recv(1024)
  20.     print ("Received :", reply.decode('UTF-8'))
  21. s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement