Q
Qu0ll
In traditional client-server programming, the client initiates requests and
the server responds. I have implemented 3 test cases of such an
architecture using NIO, servlets and RMI with zero-footprint clients (i.e.
applets). Now I would like to enhance them by adding the ability for the
server to "push" data into the client i.e. transfer data to the client even
when the client has not requested it.
This doesn't seem possible with the servlet model as the servlet only knows
anything about the client when the doGet() or doPost() methods are invoked.
Am I missing something here? Can it be done with servlets? One possibility
I thought of was to repeatedly and frequently poll doPost() from the client
and only get data back if something is available but this doesn't sound
right.
I have added the enhancement quite easily with NIO. It's simply a matter of
switching from read interest to write interest and reading the data when
it's available. Maybe this is no different from (ie. no better than)
repeatedly polling the servlet?
With RMI, I guess it depends on whether an RMI server can invoke methods on
the RMI client. Can it? Remember I am referring to zero-footprint clients
here (e.g.. applets) where I don't want the user having to run rmiregistry
or rmiserver (unless these can be run programmatically).
--
And loving it,
-Q
_________________________________________________
(e-mail address removed)
(Replace the "SixFour" with numbers to email me)
the server responds. I have implemented 3 test cases of such an
architecture using NIO, servlets and RMI with zero-footprint clients (i.e.
applets). Now I would like to enhance them by adding the ability for the
server to "push" data into the client i.e. transfer data to the client even
when the client has not requested it.
This doesn't seem possible with the servlet model as the servlet only knows
anything about the client when the doGet() or doPost() methods are invoked.
Am I missing something here? Can it be done with servlets? One possibility
I thought of was to repeatedly and frequently poll doPost() from the client
and only get data back if something is available but this doesn't sound
right.
I have added the enhancement quite easily with NIO. It's simply a matter of
switching from read interest to write interest and reading the data when
it's available. Maybe this is no different from (ie. no better than)
repeatedly polling the servlet?
With RMI, I guess it depends on whether an RMI server can invoke methods on
the RMI client. Can it? Remember I am referring to zero-footprint clients
here (e.g.. applets) where I don't want the user having to run rmiregistry
or rmiserver (unless these can be run programmatically).
--
And loving it,
-Q
_________________________________________________
(e-mail address removed)
(Replace the "SixFour" with numbers to email me)