A
Andrew E
Hi all,
The app I'm working on needs to have some simple network comms in it.
I've got a basic thing going where every connection gets a thread, etc, and it
works ok with some simple IO.
But what I want is a bit of handshaking at the front (login, etc), then
broadcast of update events.
I'm thinking messages will look something like:
[length] [typecode] [payload]
where
- length might be a 4 byte integer
- typecode might be 'S' for serialized java object, 'a' for a
string, 'x' for xml etc
I'd like to use nio even though I probably won't need the scalability.
There *must* be some good ready-to-run code out there for a reactor pattern with
some basic protocol handling stuff, ready to go, out of the box.
Some googling turned up lots of echo servers, but nothing a bit higher level
like this. This would be a bit like the python 'twisted' package but for Java.
Any tips warmly appreciated
Andrew
The app I'm working on needs to have some simple network comms in it.
I've got a basic thing going where every connection gets a thread, etc, and it
works ok with some simple IO.
But what I want is a bit of handshaking at the front (login, etc), then
broadcast of update events.
I'm thinking messages will look something like:
[length] [typecode] [payload]
where
- length might be a 4 byte integer
- typecode might be 'S' for serialized java object, 'a' for a
string, 'x' for xml etc
I'd like to use nio even though I probably won't need the scalability.
There *must* be some good ready-to-run code out there for a reactor pattern with
some basic protocol handling stuff, ready to go, out of the box.
Some googling turned up lots of echo servers, but nothing a bit higher level
like this. This would be a bit like the python 'twisted' package but for Java.
Any tips warmly appreciated
Andrew