2

I have a socket server running and listening for incoming connections on a non-admin port (i.e. > 1024). I would also like for this process to be able to handle another type of connection on a different port for monitoring purposes. I have found questions on SE for the opposite situation, many-to-one but this would be a one-to-many situation.

My questions: Is it possible to bind one process to multiple ports?

If so can I reliably handle connections on the different ports uniquely (i.e. port 2000 execute one piece of code and port 3000 execute another).

I am open to other suggestions as to how to handle a connection to monitor the other clients that are that are connecting to the primary port.

4

Absolutely possible You can use a selector or poll to receive notifications and manage each connection.

http://linux.die.net/man/2/select

2

This seems like a programming question, but for a program you have not written yet, and in an unspecified language.

Is it possible to bind one process to multiple ports?

Yes.

can I reliably handle connections on the different ports uniquely

Yes, each listening (bound) port is serviced by a separate socket (as are all the connections made from each listening port).

  • Thanks for the answer. I wanted to see if there were any reasons this wouldn't work before I begin to implement it in the application. I was trying to keep the question language agnostic. – datUser May 9 '14 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.