How to make a UDP server socket with an ephemeral port.
Hello,
I am building a system that will use a custom directory service to store communication information (process, host, port, etc.) between processes that are programmed in C. Because of this, none of my UDP server applications will need to start up and bind to a well-known port; they can use ephemeral ones. However, I must inform my directory service what that ephemeral port is once I have it. I know you can do this in TCP communications by not binding the port, but how would one go about this in UDP?
More so, once the applications has obtained the ephemeral port from the kernel, can I then call getsockname() to find out exactly what it is, so that I can send this information to my directory service?
I hope I was able to state what I'm trying to do clearly enough. Thanks for any help!
- Marvin