GeeCON Prague 2014*
The moose likes Java in General and the fly likes Help!! How can I send command to Modem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Help!! How can I send command to Modem" Watch "Help!! How can I send command to Modem" New topic
Author

Help!! How can I send command to Modem

Carlos Rincon
Greenhorn

Joined: Mar 28, 2005
Posts: 22
Can anybody tell my how can I send command to Modem using java? I am developing a desktop application using JDK 5, I know there a COMM api I can download from SUN, but I can do it with that API? how? Please ideas...

thanks in advance
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by Carlos Rincon:
I can do it with that API?


On a UNIX system, you could probably open the appropriate /dev/ttyS* file and read and write to it using ordinary FileInputStream/FileOutputStream classes. Wait, let me go try that... yes, it seems to work. That might work on Mac OS X, too.

On Windows, it's possible that you could open a file named "COM1" and write to it, and that would send a command to the first serial port... but it's also possible that it won't. You'd have to give it a try.


[Jess in Action][AskingGoodQuestions]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
With the COMM API you can control a serial port - you get control over the signal pins that control the link as well as the ability to set the speed and send/receive data. The COMM API is a very mature package and has not changed in years.
You should start by downloading the COMM package and getting the included examples working. The most common problem people have with this package is just getting the java.comm.properties file in the right directory. This file simply tells the package which driver to use - why the designers could not figure out a way to do this automatically, I'll never be able to understand.
Bill
Carlos Rincon
Greenhorn

Joined: Mar 28, 2005
Posts: 22
Thanks a lot for the replies, I have other question, the COMM api can write in serial and pararell port, I know modem is asocciate to a serial port, but not a physical serial port, but logical, so I don't sure it work...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help!! How can I send command to Modem