java - Best way to send data in a client-server App using Sockets -


hy, trying swing app(using sockets) on client side , , app server(using serversocket) database work according request.i have read sockets , how use them , main concern best way send data.

lets have collection of users , want send client shown .which best way send ?i thought serializing collection , sending client , cannot cast type (java.util.arraylist) (just example) because don`t know user class in client app,and cannot access users specific methods.that raises question :should know users in client app? sugestions good.

ps. data retrieve use hibernate.

to expand on @jb nizet, rmi easier. jmx easier still. web services easier.

basically, problem "solved" vast majority of use cases, , should looking @ technologies , frameworks rather raw sockets. unless have specific need (and don't), sockets waste of time.

web services, pox on http, remote ejbs, remote jmx, rmi , else deal of you. wheel not need reinvented.

grab glassfish or tomcat + jax-ws, , done it. write logic solve problem , make world better place instead of plumbing that's been figured out years ago.


Comments