Need example of client requesting information from server
I have a thick-client application that also acts as a server for remote clients.
I have it set up so that they send messages to each other. The server can initiate action on the client and the client can initiate action on the server.All of my communication is essentially asynchronous.
Now I want to start adding more transactional synchronous interactions, for instance:
- User initiates action on client
- Client gets data from server
- Client uses that information to perform further action
Is there a good example or tutorial for someone who hasn't done that before?
[615 byte] By [
jneaua] at [2007-11-27 9:01:53]

# 2
I should also add :)
There are different types of communication happening at the same time:
- The server is sending continual data and configuration updates to the client. The client just receives these and handles them.
- The client can request an update. This can still be asynchronous.
- The client can tell the server to perform simple actions, like "toggle timer (start/stop)". These can be asynchronous.
With the transactional, synchronous communication I want to do, I know I'll need to maintain state somehow. Would I be better off opening a new socket for the transaction?
jneaua at 2007-7-12 21:31:58 >

# 3
If you want to keep it a J2SE app im not sure you can use JMS to do it, but would have to use RMI or just plain network programming, with lots of thread control.
Anyhow if you would like to do it the easy way run a J2EE server, find a small one, but one that supports JMS (think one of the minimal installs of jboss might be good). Make a topic called messageExchange or somethign. Connect server/client to the topic. Can use MVC or something as a messagelistener. You can even persist the topic (DurableTopic) to log events to a database.
This is a little job that requires little planning compared to setting up a thread hieracy with sockets flying all around. And easier than rmi.
I have really never tought of using JMS in outside of an J2EE container, but there might be some plugins or api's that support this for J2SE.
--
Thomas
thfsa at 2007-7-12 21:31:58 >
