How do I create a Python socket server that listens on a file descriptor?

Viewed 10894

I am trying to make a Javascript (Nodejs) app communicate with a Python app.

I got something working using a socket bound to my localhost and a specific port.

To make things simpler (e.g., when deploying to environments that may not allow me to listen on multiple ports), I wanted to change my implementation to use a socket bound to a file descriptor.

I searched high and low, but all examples I found use ports.

Basically I need the Python server counter part to this example from the Nodejs docs (the version specifying a path):

var client = net.connect({path: '/tmp/echo.sock'}.

Could someone please provide a simple example showing, creation and binding a file descriptor socket and processing data on it and/or point me in the right direction?

1 Answers
Related