title: disconnecting from a socket in java
body: <p>Hi 
  i am building a little p2p program, implementing both the server-side and the client-side. 
  when I lunch the client-side program, first think it does is to connect to each server in its list, send data (about the client-side) and disconnect. The next time the client-side connects to one of these servers it will be recognized.</p>
  
  <p>My problem - when i tell the client-side to disconnect, i get this exception </p>
  
  <pre><code>java.io.EOFException
  at java.io.DataInputStream.readUnsignedShort(Unknown Source)
  at java.io.DataInputStream.readUTF(Unknown Source)
  at java.io.DataInputStream.readUTF(Unknown Source)
  at oop.ex3.nameserver.NameServerThread.run(NameServerThread.java:24)
  </code></pre>
  
  <p>to disconnect i just wrote: </p>
  
  <pre><code> finally {
          out.close();
          in.close();
          socket.close();
      }
  </code></pre>
  
  <p>so, how do i avoid this exception? thanks!</p>