Solved

Serial port & system time questions!

Posted on 1998-07-28
3
157 Views
Last Modified: 2010-03-30
No 1    I wish to open a "connection" to the serialport /dev/cua2 for instance. Right now I use a DataInputStream to
read from the port, which works kind of (it is very slow). However as I use a DataOutputStream to the port I won't receive anything ! Can U help me ?? (and plz dont write "update to jdk-1.1.6v2")

No 2 Is it possible to alter the system time via a Java interface ?? How?
0
Comment
Question by:CrypToniC
3 Comments
 
LVL 6

Expert Comment

by:gadio
ID: 1228650
Can you past the problemtic code?
0
 
LVL 2

Accepted Solution

by:
sprinkmeier earned 100 total points
ID: 1228651
1) Get the JCOM package (currently with WIN32 and SUN support, can't find where I got it at the mo..., look for jcom_w32.zip)
or try
http://java.wiwi.uni-frankfurt.de:8080/java/owa/jr_qurres?vappletno=31558
(I hope that'll work, if not, just go to http://java.wiwi.uni-frankfurt.de:8080/java/owa and search for "serial")

As for 2), probably not, 'cos it would breach security. My guess is that you could either do it with native code, or by making a JAVA timeserver and getting the system to ask JAVA what time it is.
0
 
LVL 1

Author Comment

by:CrypToniC
ID: 1228652
/*
Short description : get data on socket 7789 and relay to series port 3 (cua2) where other programs will takeover
*/


DataInputStream serialstreamIn = new DataInputStream( new                   FileInputStream("/dev/cua2") );

DataOutputStream serialstreamOut = new DataOutputStream( new FileOutputStream("/dev/cua2") );
ServerSocket snd = new ServerSocket( 7789 );

send = snd.accept();
        snd.close();

pw = new java.io.PrintWriter( send.getOutputStream(),true);

in = new java.io.BufferedReader( new InputStreamReader(send.getInputStream() ) );
        String msg = null;
          int i = 0;

 
while( true )
          {
           
try {
serialstreamOut.writeChars( (msg = in.readLine()) );
            serialstreamOut.flush();
            }

catch( IOException eee ) {}

System.out.println( "Received : " + msg);

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now