You are not logged in.

#1 2005-07-12 07:25:25

sweiss
Member
Registered: 2004-02-16
Posts: 635

Unix domain sockets in Python

Can any python expert here please show me a little example of how to use unix domain sockets?

I've tried googling without much luck, all I find are TCP socket examples.

Thanks in advance.

Offline

#2 2005-07-12 09:11:42

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Unix domain sockets in Python

I think it works just like a TCP one. Except to the socket function pass: AF_UNIX.

http://docs.python.org/lib/module-socket.html

so it uses the same syntax as a regular socket.
http://docs.python.org/lib/socket-example.html

Offline

#3 2005-07-12 10:51:52

sweiss
Member
Registered: 2004-02-16
Posts: 635

Re: Unix domain sockets in Python

Yeah I don't remember this information appearing in the docs a few weeks ago. Anyway, using a string instead of the (host, port) tuple worked.

However, when I finish using the socket, even if I do s.close(), the socket file is not removed. Am I doing something wrong?

Offline

Board footer

Powered by FluxBB