2121 *=============================================================================
2222 *
2323 * A simple dtls server example with configurable threadpool, for
24- * instructional/learning purposes. Utilizes DTLS 1.2.
24+ * instructional/learning purposes. Utilizes DTLS 1.2. Please note that if
25+ * multiple client hellos arrive at the same time, the server might drop some of
26+ * them. A production-ready server needs a more sophisticated mechanism to
27+ * multiplex packets from different clients to the same port.
2528 */
2629
2730#include <wolfssl/options.h>
@@ -185,7 +188,11 @@ main(int argc,
185188 memset (& args [i ], 0 , sizeof (thread_args_t ));
186189 args [i ].activefd = listenfd ;
187190 listenfd = new_udp_listen_socket ();
188- /* avoid messages from other peers */
191+ /* Avoid future packets from other peers to be received over
192+ * args[i].activefd. Please note that packets from other clients
193+ * already received might be returned from future invocations of
194+ * recvfrom()/read(). The args[i].ssl object will discard those packets
195+ * that don't match the set DTLS peer. */
189196 ret = connect (args [i ].activefd , (const struct sockaddr * )& cliaddr , cliLen );
190197 if (ret != 0 ) {
191198 printf ("error: connect returned: %d\n" , ret );
@@ -200,7 +207,7 @@ main(int argc,
200207
201208 ret = wolfSSL_set_fd (args [i ].ssl , args [i ].activefd );
202209 if (ret != SSL_SUCCESS ) {
203- printf ("error: wolfSSL_set_dtls_fd_connected : %d\n" , ret );
210+ printf ("error: wolfSSL_set_fd : %d\n" , ret );
204211 break ;
205212 }
206213
0 commit comments