0

I've got a server with a number of worker processes forked initially with the server setup. The sever accepts connections, and must pass the descriptor to a worker.

What's an easiest way that I could later on share the socket descriptor of a client's connection with a worker?

2
  • 1
    See stackoverflow.com/questions/28003921/… for a way to send an open file descriptor to another process. Other examples can be found via Google search: google.com/search?q=sendfd Commented Apr 15, 2018 at 0:40
  • Thanks a lot. Unix Network Programming reference really helped. Commented Apr 15, 2018 at 12:53

1 Answer 1

1

I would suggest you to run workers with specific port range and use socketpair to share the socket descriptor from another port. Also you can block those worker ports for external communication for the sake of good security pratices.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.