title: sending text data over network in java
body: <p>I have a use case where we have two different java programs doing:</p>
  
  <ol>
  <li><p>First java program has to send some parameters to invoke the second java program.</p></li>
  <li><p>First java program has to send datastream to the second program.</p></li>
  </ol>
  
  <p>The approach that I have in mind is:</p>
  
  <ol>
  <li><p>Use Socket class where second java program is socket server and first java program socket client.</p></li>
  <li><p>First java program serializes the arguments needed by second java class to initialize it's class object that performs the task. Second java program de-serializes it.</p></li>
  <li><p>Now the first java program has to send data that second java program on another machine would work on. The First program can send data as a <code>BufferedWriter</code> object but how will server know that it is receving the arguments and after arguments, it has got the stream to work on ?</p></li>
  </ol>
  
  <p>Any other inputs for the approach are greatly appreciated !</p>
  
  <p>Thanks</p>