Skip to content

Instantly share code, notes, and snippets.

@chrishulbert
Created April 5, 2011 00:24
Show Gist options
  • Save chrishulbert/902774 to your computer and use it in GitHub Desktop.
Save chrishulbert/902774 to your computer and use it in GitHub Desktop.
Python unix socket example
import socket
minissdpdSocket = '/var/run/minissdpd.sock' # The socket for talking to minissdpd
# Sends a message to the given socket
def sendMessage(message):
s = socket.socket(socket.AF_UNIX)
s.settimeout(1) # 1 second timeout, after all it should be instant because its local
s.connect(minissdpdSocket)
s.send(message)
s.close()
@rensg001
Copy link

thanks, it's useful for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment