title: Best way to send data in a client-server App using Sockets
body: <p>Hy, what i am trying to do is an Swing App(using sockets) on the client side that does something , and another App for the server(using serverSocket) which does all the database work according to the request.I have read about sockets and how to use them , my main concern is which is the best way to send data.     </p>
  
  <p>Lets just say that i have a collection of users and i want to send it to the client to be shown .Which is the best way to send it ?I thought about serializing the collection and sending it to the client , but  i cannot cast to the type (java.util.ArrayList) (just an example) because i don`t know about the user class in the client App,and i cannot access the users specific methods.That raises the question :should I know about the Users in the client App?  So any sugestions are good.   </p>
  
  <p>PS. For data retrieve i use Hibernate.</p>