"Socket" files?

Irmen de Jong irmen at -nospam-remove-this-xs4all.nl
Fri Aug 20 18:59:18 EDT 2004


Marcos Dione wrote:

> On Fri, Aug 20, 2004 at 09:58:43PM +0100, Paulo da Silva wrote:
> 
>>How are those "files" of type "socket", whose name
>>begins with "=", created? How can I create them with
>>python?
> 
> 
>     they don't start w/ =; that's just ls being verbose. try 'ls -1'.
> 
>     you can create them with os.mkfifo. see lib doc, section 6.1.4.

mkfifo creates fifo nodes, not "socket"-type files.
I think Unix domain sockets are what the OP means...
Which are created by using the AF_UNIX socket type:

from socket import *
sock=socket(AF_UNIX,SOCK_STREAM)
sock.bind("/tmp/mysocket")

BTW, my ls lists them in pink, with a '=' at *the end*.
That's on Mandrake 10.

--Irmen




More information about the Python-list mailing list