Is this just not possible in Java? The DatagramSocket.bind method must accept either NULL or IP: PORT. You cannot just pass the IP address describing the network adapter and let PORT be automatically selected. The view does not make sense if I am missing something.
Use the default constructor of DatagramSocket . This will be bound to any port. You do not need to use the bind method.
DatagramSocket
Simply enter a port number of zero, or omit it, as suggested by Mike Q. In both cases, the system will allocate a port for you.
Source: https://habr.com/ru/post/1434061/More articles:How to prevent apache reduction from double slashes with a single slash in the url? - urlHow can I populate two beans from my form using Spring MVC? - javaIs it possible to use glob.has_magic? - pythonCalling various web services in parallel with Webapp - javaZF2 - ServiceManager dependencies in controllers - phpChanging jQuery element id causes error - jqueryreading environment variables from java using Eclipse - javaHas the device token format provided by APN been changed in my application? - ios"hide" installed Android application - androidWhen creating a custom value with defcustom, how can I check user records? - emacsAll Articles