• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help!! How can I send command to Modem

 
Carlos Rincon
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13049
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic