Hi Mark, On 30/09/2019 08:58, mark sheppard wrote:
So does the second MulticastSocket need to use the same client unicast address ?
The clientAddress is an InetSocketAddress with port 0. It is possible that the second MulticastSocket will get the same port allocated to it, because the first one has been closed - but it's probably unlikely.
Can it be assured that there is no asynchrony in the synthesized code for the autoclose in the try with resources, both at the java level and within the OS kernel executing the close? Would an explicit close of the first MulticastSocket add better determinacy to the test execution?
try-with-resource will close the first socket just as in try { } finally { } - there is no mystery here. So the answer to the above is clearly no.
n the DatagramSocket version, a level of synchronization between the server thread and the main thread was added, would that be appropriate here again?
I don't think so all that matters is that the server DatagramSocket is created before the datagram packet is sent. best regards, -- daniel