Python Forum

Full Version: unix domain sockets
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
has anyone here used unix domain sockets in python?
Sometimes I use socket.socketpair() ...
let me update that question. has anyone here used unix domain named sockets in python? that is, sockets that are in filesystem space and the client connects by referring to, or opening that socket file path. i am curious how this family of sockets gets used by python applications and how easy it can be in python. for example, do you use file descriptors or python files?
Have you read the pymotw about unix domain sockets?
i know the fundamentals of unix domain sockets from having done them in C. what i am curious about is what people have done that uses them in python,such as what they have written using them.
I never used them in Python. But there is no much difference between AF_UNIX and AF_INET/AF_INET6.
Unix sockets are often used on Linux systems. For example the mysql server is using an Unix socket.
is the mysql server coded in python?
I guess in C or higher level language. But this doesn't matter.
It's not the language which define the use of unix domain sockets.

If you want to see a use case in Python, just look at a mysql driver.
It should able to connect also via Unix Domain Socket.
but does the Python coder need to be aware that unix domain is being used, or is that a hidden detail? i'm looking for cases where the Python coder needs to know, or needs to code socket calls for that. even better would be a case where a choice could be made and unix domain addressing would be the better (design) choice.

i need to send datagrams to one of three servers over the internet but i am wanting to split out the decision of which to send to, to a different process. it is the transfer of these datagrams between these two processes where i am considering unix domain in lieu of inet domain. the reverse is alao involved. the decision of where to send them to is based on where the previous reply datagrams come from, including load balancing. this is all to be opaque to the process generating the datagrams.