Python Forum
unix domain sockets - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: unix domain sockets (/thread-12561.html)



unix domain sockets - Skaperen - Aug-30-2018

has anyone here used unix domain sockets in python?


RE: unix domain sockets - Gribouillis - Aug-31-2018

Sometimes I use socket.socketpair() ...


RE: unix domain sockets - Skaperen - Aug-31-2018

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?


RE: unix domain sockets - Gribouillis - Sep-01-2018

Have you read the pymotw about unix domain sockets?


RE: unix domain sockets - Skaperen - Sep-01-2018

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.


RE: unix domain sockets - DeaD_EyE - Sep-01-2018

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.


RE: unix domain sockets - Skaperen - Sep-01-2018

is the mysql server coded in python?


RE: unix domain sockets - DeaD_EyE - Sep-02-2018

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.


RE: unix domain sockets - Skaperen - Sep-02-2018

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.