How to use Java MulicastSocket (UDP)?
<p>I develop client-server application, working in real-time. Server and clients exchanges by small messages, so I choose UDP for my architecture (as suggested in many articles in network).
It's not a problem for me to use default java's DatagramSocket/DatagramPacket for orginizng all things as I want, but when I read documentation I see the "MulticastSocket" opportunity.
But it is completely unclear for me: <strong>How MutlicastSocket at the user side will know where to connect? (public IP/port of the server)</strong>. Really, as this shown at this official java <a href="https://docs.oracle.com/javase/tutorial/networking/datagrams/broadcasting.html" rel="nofollow">tutorial</a>.
MulticastSocket creates like:</p>

<pre><code>MulticastSocket socket = new MulticastSocket(4446);
InetAddress group = InetAddress.getByName("203.0.113.0");
socket.joinGroup(group);
</code></pre>

<p>and there is NO any specification about public server IP and port. 
What is "203.0.113.0"? It is possibles that tones of applications send something to that address in web, isn't it?</p>

<p>When I create client in regular (not Multicast) way I use something like:</p>

<pre><code>DatagramSocket outputClientSocket = new DatagramSocket();
DatagramPacket outputPacket = new DatagramPacket(new byte[512],512,InetAddress.getByName("94.***.89.***"),9898);
...
</code></pre>

<p>where "94.???.89.???" is my server's public IP address, and 9898 is port of my server, that listens it. Like that:</p>

<pre><code>DatagramSocket serverInputSocket = new DatagramSocket(9898);
DatagramPacket inputServerPacket = new DatagramPacket(new byte[512],512);
serverInputSocket.recieve(inputServerPacket);
</code></pre>

<p>and after recieving something I can establish connection with client, and answer something for him, like that:</p>

<pre><code>DatagramSocket socketForSpecificClient = new DatagramSocket();
InetAddress realClientAddress = inputServerPacket.getAddress();
int realClientPort = inputServerPacket.getPort();
DatagramPacket packetForSpecificClient = new DatagramPacket(new byte[512],512,realClientAddress,realClientPort);
socketForSpecificClient.send(packetForSpecificClient);
</code></pre>

<p>This approach works well, even if client has no public IP. 
It is absolutely clear way of establishing connection for me, but I can't understand for what purposes MulticastSocket should be used?</p>