title: Bidirectional UDP Multicast
body: <p>I am writing a network backend for a game server.</p>
  
  <p>I planned on using multicast, so that clients could bind to the server via a multicast socket. The server could then send game updates to all members of the group.</p>
  
  <p>I'm wondering, however, if it's possible to do the <strong>reverse</strong> — can clients send unicast data to the server, <em>over the same port as the multicast socket</em>?</p>
  
  <p>I've written a test program based off of the <a href="https://docs.oracle.com/javase/tutorial/networking/datagrams/broadcasting.html" rel="nofollow">Java Tutorials</a> (which only sends server —> client), but I was unable to adapt that to bidirectional communication. I'm getting <code>Address already in use</code> and <code>Not a multicast address</code> errors on the client.</p>
  
  <p>Are my suspicions correct that such bidirectional communications are not possible using the same port? Must I use different ports (one for multicast [server —> clients], one for unicast [clients —> server])?</p>
  
  <p>(I'm doing this in Java, but I'm more interested in the network-side-of-things <em>is this possible</em> vs. implementation-side <em>how do I do this</em>.)</p>