Advertisement
rfmonk

tcpip_ipv4_client.py

Nov 22nd, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. #! /usr/bin/env python
  2. # Echo client program
  3. """ docs.python.org/2/library/socket.html """
  4.  
  5. import socket
  6.  
  7. HOST = 'docs.python.org'    # The remote host
  8. PORT = 50007              # The same port as used by the server
  9. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  10. s.connect((HOST, PORT))
  11. s.sendall('Hello, world')
  12. data = s.recv(1024)
  13. s.close()
  14. print 'Received', repr(data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement