Guest User

Untitled

a guest
May 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. from socketwrapper import TCPSocket
  2. import sys, select
  3.  
  4. def read_line():
  5. if len(select.select([sys.stdin],[],[],0.001)) > 0:
  6. return raw_input()
  7. return None
  8.  
  9. connected = True
  10.  
  11. def on_disconnect():
  12. print "Disconnected"
  13. connected = False
  14.  
  15. sock = TCPSocket("118.90.57.247", 10200, on_disconnect)
  16.  
  17. while connected:
  18. data = sock.Receive()
  19. if data != None:
  20. print data
  21.  
  22. line = read_line()
  23. if line != None:
  24. sock.Send(line)
Add Comment
Please, Sign In to add comment