title: How to send XML data through socket InputStream
body: <p>I'm trying to write a client-server application in Java with an XML-based protocol.
  But I have a great problem!</p>
  
  <p>See this part of client code:</p>
  
  <pre><code>InputStream incoming = skt.getInputStream(); //I get Stream from Socket.
  OutputStream out = skt.getOutputStream();
  
  [...]
  
  XMLSerializer serializer = new XMLSerializer();
  //This create an XML document.
  tosend = WUTPClientWriter.createMessage100(projectid, cpuclock, cpunumber);
  serializer.setOutputByteStream(out);
  serializer.serialize(tosend);
  </code></pre>
  
  <p>At this point server fall in deadlock. It wait for EOF but I can't send it because if I use </p>
  
  <pre><code>out.close();
  </code></pre>
  
  <p>or</p>
  
  <pre><code>skt.shutdownOutput();
  </code></pre>
  
  <p>I close the Socket and I must keep this connection alive.</p>
  
  <p>I can't send '\0' becouse I get Parse Error in the server.</p>
  
  <p>How can I do it? Can I "close" the output stream without closing the socket?</p>
  
  <p><strong>RESOLVED</strong>
  I've created new class XMLStreamOutput and XMLStreamInput with advanced Stream gesture.</p>