Skip to content

Instantly share code, notes, and snippets.

@Averroes
Created April 10, 2015 17:18
Show Gist options
  • Select an option

  • Save Averroes/e5ed6ed065e8d2f0b00d to your computer and use it in GitHub Desktop.

Select an option

Save Averroes/e5ed6ed065e8d2f0b00d to your computer and use it in GitHub Desktop.
passing a socket file descriptor between processes
from socket import socket, AF_INET, SOCK_STREAM
s = socket(AF_INET, SOCK_STREAM)
s.connect(('localhost', 15000))
s.send(b'Hello\n')
print('Got:', s.recv(8192))
s.send(b'World\n')
print('Got:', s.recv(8192))
s.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment