From: Brett L. <wak...@gm...> - 2008-09-04 00:11:07
|
> -----Original Message----- > From: rai...@li... [mailto:rails-devel- > bo...@li...] On Behalf Of John A. Tamplin > Sent: Wednesday, September 03, 2008 5:02 PM > To: Development list for Rails: an 18xx game > Subject: Re: [Rails-devel] Starting on a client/server > > On Wed, 3 Sep 2008, Brett Lentz wrote: > > That's not exactly how I read the function of java.net.Socket or > > java.nio.SocketChannel. > > > > I'd need to double-check the API docs, to be sure, but I believe what > are > > passed are text representations of each object. So, we'll need to > verify > > that the default toString() method is an acceptable representation > for each > > object, or we'll need to override toString() with our own > representation > > that does pass the necessary data. > > Sockets are byte channels, and you can send whatever you want across > them, > such as serialized objects. > > -- > John A. Tamplin ja...@ja... > 770/436-5387 HOME 4116 Manson Ave > Smyrna, GA 30082-3723 > Great! So then tossing our objects over the SocketChannel ought to be relatively easy. 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. ---Brett. |