Basically the server has a sort of waitForSocket
type method, since it is the server and expects clients. The client says let me connect to THIS server
, a socket is opened and now the server will [probably] create a new thread to handle the socket and wait for another socket.
You choose what data you send, you can send your own custom formatted data, xml data, or whatever tickles your fancy. Google (believe it or not) has plenty of good links for examples of Java networking code; I'm off to bed so see if you can find a better link than "Handling network timeouts"