[Gabel-guys] Dispatcher
Status: Alpha
Brought to you by:
alllee
|
From: Andy J. <and...@in...> - 2004-06-03 22:34:31
|
The dispatcher now lives!
Here's the quick rundown...
. Starting a server is as easy as pie
disp = new Dispatcher();
disp.startServer();
. Making connection is as easy as pie
disp = new Dispatcher();
id = disp.connect(String host, int port);
o Dispatcher makes the connection and return an identifier which should
be used in future transactions
o Dispatcher manages the Channel for you, will let you know when input
comes { via accept(int, byte[]); }
o Use write(int id, byte[]); to send data via the connection
. Any object interested in received dispatcher happenings should implemens
the DispatcherSink interface, three methods
o accept(int id, byte[] buff); // accept data
o acceptConnection(int id); // accept connection
o dropConnection(int id); // drop a connection
. Using this DispatcherSink it would be very easy to write a bridge class
that implements the DispatcherSink and produces events which it then
pushes into the event pool
. The other two classes SelectorWrapper.java and SelectionKeyAcceptor.java
are really just internal classes, but may be useful if you want to wrap
a selector for convience sake in the future
. Things to do...
o Can't really stop the server, need to make the ServerSocketChannel a
non-blocking Channel that is registered with the internal selector
like anything else, able to stop
o Non-connections are not detected
o No clean way to disconnect channels yet
o Add logger capabilities to error handling (currently println's)
-Andy
Repel them. Repel them. Induce them to relinquish the spheroid.
-- Indiana University football cheer
----------------------------------------------------------------------
THE SMURFS AND THE CUISINART (1986)
The lovable little blue Smurfs encounter a lovable little kitchen
appliance, which invites them to play. The Smurfs learn a valuable
(if sometimes fatal) lesson.
THE SMURFS AND THE CARBON-DIOXIDE INDUSTRIAL LASER (1987)
The inevitable sequel. The lovable and somewhat mangled surviving
Smurfs team up with the Care Bears to encounter a cute, lovable piece
of high-tech welding equipment, which teaches them the magic of
becoming rather greasy smoke. Heartwarming fun for the entire family.
+++++++++++++++++++++++++
'(Andy Jones)
Home: (812) 337-1438
Work: (812) 333-3134
and...@in...
IU Comp Sci Grad
web...@co...
+++++++++++++++++++++++++
|