We help IT Professionals succeed at work.

How to fetch data from a digi cell modem device via Java

Medium Priority
Last Modified: 2012-05-12
I am new and want to lear how real time communication takes place and how can I implement it. Let me explain the objective.  

I want to write a program in JAVA that will connect to a remote assets let's say TRUCKS. (The big trucks that carry cargo) Trucks have a digi device (cell modem)  installed which is connected to the onboard computer (via a serial port, each truck has a computer).
All the event logs, status messages etc. are on the computer. I will need to connect to the Digi (cell modem) device by sending the IP address and the port. For example, I will need to send a command "connect me to  this IP at this port.
The commands/messages that I send to the Digi device (cell modem) will be relayed to the computer and responses from the computer will be sent by the  Digi (cell modem) to my Java program which will put them in a queue.

I need to talk to the Digi device. Let's say there are 1,000 truck. I will perhaps need to store 1,000 IP and port #s in the database. My java program will pull the IP and port info from the database and send 1,000 command to 1,000 unique trucks.

Let's say, we need to downlaod event logs/status messages from 1,000 truck every 15 minutes. So I will need to send a command to the Digi device (cell modem) everything 15 minutes for all 1,000 trucks.

How can I write such program to fetch data from a digi cell mode, device?
I can use one of the following protocols:

XMPP (Jabber)
Secure FTP
Secure MQ

I would like to know which one should I choose and why? (I am looking for recommendations).
Watch Question

SSL is used to secure the other protocols but it shouldn't be in this list as an item by itself.

Secure MQ from IBM is going to be very expensive.  The trucks have onboard computers so if you are able to abstract all of the messages as files you can use the file system as a message queue if you process files according to the date/time stamp... you could implement it as a priority queue by using the file name as the first sorting priority and then the date/time stamp as secondary.  This should be a sufficient queue for your requirements.  There are tons of mid-sized organizations in this country that are totally dependent on 20-year-old proprietary IBM technology.  The annual fees are so high that they don't have available resources to migrate to something else so they are trapped.  You'll avoid this fate by using standards-based off-the-shelf solutions.  

Forget the cell modem.  It is a means to an end.  Concentrate on the fact that you've got a computer in the truck talking to the computer in the home office.  Each truck communicates only with the central computer so individual trucks do not need to communicate with each other.  That sounds like a client-server configuration rather than node-to-node... so HTTPS or Secure FTP are better matches to the communication model than Jabber.

The term "secure FTP" could mean two different protocols, either SFTP or FTPS.  The former is secured by SSH and the latter by SSL so they offer similar levels of encryption.  HTTPS and FTPS can require certificate authentication but SFTP can require SSH key authentication so your enhanced authentication options are also comparable.

When it comes to the complexity of the network the fact that HTTPS uses only a single port is a big plus.  SFTP also uses only one port but FTPS uses 1 static port for control and 1 roving port for data.  So if your "secure FTP" option is FTPS you'll be taking on a more complicated firewall configuration.  Most commercial-quality firewall hardware can do this work for you automatically but it is a challenge for ordinary home users.

When it comes to comparing servers, it is hard to argue with the track record of database-backed HTTPS servers.  They are the core of every large web site on the Internet.  Imagine any web site that has individual login accounts: Facebook, Gmail, Amazon, Ebay and even Experts Exchange.  All support thousands of concurrent client connections. This is a client-sever model using a database-backed server where the client is a computer and they communicate with HTTP(s)  The most popular web servers, Apache and IIS, are basically free.  There is a mature, open market for developer talent so you are not locked in to paying cartel prices for proprietary technology.  When comparing servers the best thing I can say about Secure FTP vs. HTTPS is that the initial server setup might be faster in the sense that the FTP server is so easy to configure out of the box so each client has its own virtual root folder so this allows you quickly prototype a scenario where each client is transferring files to its own folder on the server.

Comparing clients... ok so between HTTPS or SFTP or FTPS for any of these there are easily available libraries that you can use in your software to do all the hard protocol-level work.  There are open-source options and there are commercially supported options.  The commercial market for these libraries is mature which means you can get a supported library with a redistributable license for cheap (< $1000) so for your application I would recommend doing that instead of open source.  If you design the client with an eye to the future the transport libraries could be almost 100% interchangeable and avoids vendor lock-in.

So there is no clear winner with regard developing the clients but one thing HTTPS has going for it is that every laptop sold in this country since 1998 has a web browser pre-installed.  Web browsers shouldn't be used as the actual truck-based client but they would be handy to use for testing the server-side logic during system development and, after the system is deployed, they could be used as human-readable field debugging tools.

So my vote would be HTTPS followed by Secure FTP and the distance between the first and second choice depends on if you mean SFTP or FTPS.



Thank you for taking time and writing a detailed response.

Let me make few things clear:

About the onboard computers on the trucks: These are proprietary boxes with a processor probably running on Linux.

The java application that I need to write should send commands/messages to get the data/messages from the truck using digi cell modem and the messages must be put in a signle queue (or may be in a single folder). The messages will be picked from the queue/folder for processing/diagnosis and displaying reports/health/alerts on a customer facing web portal.

I would also like to know what will I need to do to remotely connect to digi cell modems to pull the data/messages from the turck.

Thank you

This will be much easier if you flip the communication paradigm on its head such that each truck "calls home" every X minutes.  Upon connection the truct will upload its status and download any  commands/messages.  This could approach near real-time for sufficiently small values of X... of course it could also be a monsterous waste of bandwidth if you only NEED to contact the truct rarely.

You might also look into the Amazon Kindle "whisper net' which uses 3g cell technology to deliver eBooks to the little eReader computers.


It would have been ideal if i coud Flip the communication paradigm but that is not my choice. So please discuss/suggest solution for as-is requirement.

It seems like it might be expensive to leave all the connections up all the time.

On the other hand if you are only sending commands every 15 minutes anyway then its not real-time anyway so it shouldn't matter which side initiates the connection.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.