Advertisement
j311yf1sh

chatty

Aug 5th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import socket
  2.  
  3. def run():
  4.     host = "192.168.1.2"#host derp
  5.  
  6.     port = 9753#port derp
  7.        
  8.     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  9.  
  10.     idle()
  11.  
  12. def idle():
  13.    
  14.     Choice = raw_input("Would you like to 1)Recieve 2)Send?: ")
  15.    
  16.     if Choice == "1":
  17.         recievey
  18.     elif Choice == "2":
  19.         sentence = raw_input("What would you like to send?: ")
  20.         sendy
  21.        
  22. def sendy():
  23.        
  24.     sock.connect((host, port))
  25.  
  26.     sock.send(sentence)
  27.  
  28.     idle()
  29.  
  30. def recievey():
  31.    
  32.     results = sock.recv(1024)
  33.  
  34.     sock.close
  35.  
  36.     print results
  37.  
  38.     idle()
  39.  
  40.  
  41. run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement