From: Erik V. <eri...@hc...> - 2008-09-04 19:50:32
|
> > Sockets are byte channels, and you can send whatever you want across > > them, > > such as serialized objects. > > Great! So then tossing our objects over the SocketChannel ought to be > relatively easy. You might need to think about some little protocol around that, as a byte channel has no "sentence integrity", i.e. it does not know where one message ends and another one starts. Not sure if that is really needed in this case. > It seems that java.nio.SocketChannel is probably a better choice than > java.net.Socket. It seems like it's easier to manage multiple > connections to > the same port more easily with a SocketChannel. I'm new to > this part of the > Java API, but that's my first impression. A while ago I built a kind of package around java.nio.SocketChannel for a specific case where one client controls multiple servers. I tried to make it as generic as possible. With some changes it might be turned into something that we could use. I'll check tomorrow. Erik. |