[Tutor] open a socket from a named file on linux

dm linux236r4 at hotpop.com
Mon Feb 28 00:18:16 CET 2005


Hello, I am trying to open a socket connection to a named file on my
computer and can not seem to get it working.  Any help or advice would
be great.

The details

I attempting to control xfmedia,
http://spuriousinterrupt.org/projects/xfmedia/ , via it's remote from
python and I can not get a connection.

connection information from readme file
<quote>
Xfmedia has a remote control system, which consists of a UNIX socket
in /tmp, xfmedia_remote.$UID.$SESSION_ID, where $UID is the uid of the
user running xfmedia, and $SESSION_ID is a number (starting from zero)
corresponding to the instance of xfmedia.  (For example, if you're
running
one copy of xfmedia, $SESSION_ID will be 0.  If you start a second
instance,
its $SESSION_ID will be 1.  And so on.)
</quote>

when attempting to creat a connection with this command

s = socket.fromfd('/tmp/xfmedia_remote.1001.0', socket.AF_UNIX,
socket.SOCK_STREAM)

i get this error

</xfmedia_remote.1001.0', socket.AF_UNIX, socket.SOCK_STREAM)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?

which i understand i need to use the file descripter instead but i can
not not get the file descripter because when i attempt to open 
/tmp/xfmedia_remote.1001.o with the open command i get an error

f = open('/tmp/xfmedia_remote.1001.0')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 6] No such device or address:
'/tmp/xfmedia_remote.1001.0'

yet ls shows the file exists, xfmedia is working fine.






More information about the Tutor mailing list