I am asking it from a practical sense. In TCP, accept() will give us new socket for every connect(). It allows multiple concurrent communications with only one server port.
The questions is why we do not have such convenience in UDP? Don't tell me UDP is connectionless, hence... Logically, accept() has nothing to do with that (the underlying IP is connectionless anyway).
One consequence is that you have to apply lots of UDP ports, which may complicate firewall settings. So my next question, What is the solution for multi-client UDP application regarding port and multiplexing? In some case, I am thinking to embed client information in UDP packet and let the server differentiate. But inherently without accept(), certain to-do is hard (e.g., UDP with OpenSSL).
Thank you for the insight.
Because UDP is a connectionless protocol, you don't need it. You get remote address information with every incoming UDP datagram, so you know who it's from, so you don't need a per-connection socket to tell you. You don't 'have to apply lots of UDP ports' at all. You only need one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With