Guest User

Untitled

a guest
May 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import socket
  2. import pygame
  3.  
  4. pygame.init()
  5. tcpCliSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  6. tcpCliSock.connect(("localhost", 6882))
  7.  
  8. while 1:
  9. pygame.event.pump()
  10. data = " "
  11. for i in pygame.event.get(pygame.KEYDOWN):
  12. data = i.key
  13. tcpCliSock.send(data)
  14. data = tcpCliSock.recv(1024)
  15. if not data: break
  16. print data
  17.  
  18. tcpCliSock.close()
  19. pygame.quit()
Add Comment
Please, Sign In to add comment