title: MulticastSocket: Socket operation on non socket
body: <p>I have some code like this:</p>
  
  <pre><code>InetAddress bind = InetAddress.getByName("192.168.0.1")
  MulticastSocket socket = new MulticastSocket(new InetSocketAddress(bind,0));
  socket.setInterface(bind);
  </code></pre>
  
  <p>On windows 7 and windows XP with JDK6u17,I got a SocketException: Socket operation on non socket.</p>
  
  <p>But if I change the line 2 to :</p>
  
  <pre><code>MulticastSocket socket = new MulticastSocket(0);
  </code></pre>
  
  <p>It's ok, and works find too with jdk6u14.</p>
  
  <h2>Why? thanks.</h2>
  
  <p><strong>EDIT:</strong>
  Why port 0 should be the matter?</p>
  
  <pre><code>MulticastSocket socket = new MulticastSocket(0);
  </code></pre>
  
  <p>Everything goes well with this code.But not</p>
  
  <pre><code>MulticastSocket socket = new MulticastSocket(new InetSocketAddress(bind,port));
  </code></pre>
  
  <p>Whatever the port is.</p>