1

I have a quite specific client-server design case and I want to ask for suggestions. The task is about enhancing an existing system with new functionality.
The system is composed of a server with public IP, 10 - 1000 CLDC clients with dynamic IP, and a device that communicates with the server over the serial port (COM).

Client(J2ME):
Logs into the server and stays logged in, spontaneously asks server for some data, but mainly waits for server requests. The client is (probably, first thought) responsible for keeping the connection with server alive.

Server (preferably windows, Java):
Waits for clients to connect, stores and maintains all client connections (in case the server wanted to send a request to the client, as clients have dynamic IP addresses). The server stores data coming from the COM device. Waits for requests from clients and provides them with desired (previously stored) data. It also waits for COM device requests.

COM device:
Provides the server with data (this is the data that clients spontaneously ask for). It also sends requests (server should pass those requests to particular clients). The COM device drives the whole system.

What I need to design is the server and software for clients. Serial device is unchangeable.

Do you have any suggestions for the best approach here?

Regards!

user283133
  • 13
  • 2

1 Answers1

1

J2ME

I have developed many systems involving J2ME and a backend. The one thing you need to watch out for is that the client connection that the server holds may not always be "open" because GPRS/3G is not very reliable (depending on the service provider/country). So you are right that the client is responsible for keeping the connection open.

Server

In general you can treat this like a normal multi threaded socket server.

On a windows system (assuming you programming in java) have a look at opening a java.io.File to a file name "COM1" in order to communicate with your serial device. This will make your life much easier instead of truing to do native serial communication.

It seems pretty straight forward so i am not sure what one can suggest.

Paul
  • 4,812
  • 3
  • 27
  • 38
  • Thanks for answer Paul. So you think that application server like tomcat or glassfish is not needed here? What I'm affraid of is the number of open connections. Is socket server application running on winodows capable of keeping 1000 open connections? – user283133 Feb 28 '10 at 18:45
  • Most definitely! see http://stackoverflow.com/questions/2185834/maximum-number-of-socket-in-java You could use an application server and implements your own sockets. I would not suggest HTTP/s as it is inherently stateless. Check out JBoss jetty and Apache MINA, they are really useful socket/connection libraries. – Paul Feb 28 '10 at 20:33
  • unfortunately, not using HTTP for client-server communication means you're risking the client mobile network operator filtering out the client connections. – michael aubert Mar 01 '10 at 17:19