title: How to send a list of files over a socket in Java
body: <p>I have used the code <a href="http://forums.devx.com/showthread.php?t=148749" rel="noreferrer">here</a> to send an individual file over a socket.  However, I need to be able to send multiple files (basically all files in a directory) over the socket and have the client recognize how the separation between files.  Frankly, I am at a complete loss for what to do.  Any tips would be helpful.</p>
  
  <p><strong>NOTE 1:</strong> I need a way to send the files in one continuous stream that the client can segregate into individual files.  It cannot rely on individual requests from the client.</p>
  
  <p><strong>NOTE 2:</strong> To answer a question I am pretty sure I will get in the comments, no, this is <strong>NOT</strong> homework.</p>
  
  <p><strong>EDIT</strong> it has been suggested that I could send the size of the file before the file itself.  How can I do this, as sending a file over the socket is always done in either a predetermined array of bytes, or a single byte individually, rather than the long returned by <code>File.length()</code></p>