@programervn,
The use case you've just inquired about is quite complex with DTLS. Remember with UDP Datagrams all arrive on the same port on the server side unlike TLS which uses a tuple to guide traffic to a unique destination port on the server. Because of this the only way to handle many clients in parallel is do the following setup:
1) Configure the underlying I/O to be nonblocking (nonblocking sockets)
2) Implement a database or table for storing SSL object references
3) Peek at the header information in arriving datagrams and get the IP/port number of the client (will be unique based on IP/port combination). Parse your table/database, if no SSL object exists for the IP/port combination then create a new SSL object and register an entry in your table/database associating the IP/port with the ssl object reference.
4) For any IP/port combination registered with an SSL object in the lookup table/database return that SSL object for handling that datagram.
5) Make sure to clear out entries when the connection terminates.
The complexity of this setup is significant, if you have any issues and need assistance we do provide consulting services to assist with complex setups of this nature. If you need further assistance or are interested in our engineering services shoot an email to support@wolfssl.com for more help.
Warmest Regards,
K