How to create a Unix Domain Socket?
Donn Cave
donn at u.washington.edu
Wed Oct 18 12:28:11 EDT 2000
Quoth Carsten Gaebler <cg at schlund.de>:
| How do I create and write to/read from a Unix Domain Socket file in
| Python? The documentation of the socket module does not explain how to
| create a socket file.
import socket
su = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
su.bind('/tmp/suname')
Like many other C bindings in Python, this one has been adapted
to suit Python's basic language model, but otherwise follows the
underlying C API pretty closely. The Python documentation tends
to be mostly concerned with the Python-specific issues. Rather
than look there for every detail of the API, you should refer
to the documentation on the host system, e.g., "man socket", which
will be more complete (and more accurate when there are differences
between one platform and another, as there are with sockets.)
Donn Cave, donn at u.washington.edu
More information about the Python-list
mailing list