Advertisement
xxmbabanexx

Small Client

Mar 30th, 2013
251
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None
  1. import socket #for sockets
  2. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  3. print "Socket Created"
  4.  
  5. #Get host and port info to connect
  6. host = "Alec.local"
  7. port = 2468
  8. s.connect((host, port))
  9.  
  10.  
  11. while True:  
  12.     #Send some data to the remote server
  13.     message = raw_input(">>>  ")
  14.  
  15.     #set the whole string
  16.     s.sendall(message)
  17.  
  18.        
  19.     reply = s.recv(1024)
  20.     print reply
Advertisement
RAW Paste Data Copied
Advertisement