Guest User

Untitled

a guest
Oct 20th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. File "client.py", line 6, in <module>
  2. s.connect((host, port))
  3. File "/usr/lib/python2.7/socket.py", line 228, in meth
  4. return getattr(self._sock,name)(*args)
  5. socket.error: [Errno 111] Connection refused
  6.  
  7. `import socket`
  8.  
  9. s = socket.socket(socket.AF_INET6,socket.SOCK_STREAM)
  10.  
  11. host = "127.0.0.1"
  12. port = 5005
  13. s.connect((host, port))
  14. print(s.recv(1024))
  15. s.send('send me a salutation')
  16. s.close()
  17.  
  18. import socket
  19. s=socket.socket()
  20. address = ''
  21. port = 5005
  22. s.bind((address,port))
  23. s.listen(5)
  24. while True:
  25. conn,addr=s.accept()
  26. print 'Connection address: ',addr
  27. conn.send('Thank you for your connecting')
  28. conn.close()
Add Comment
Please, Sign In to add comment