Solved

Serial port & system time questions!

Posted on 1998-07-28
3
161 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 106
windows explorer path to command prompt 5 54
MySQL  on Tomcat 8 70
spring maven example issues 3 13
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…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

830 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