Solved

Serial port & system time questions!

Posted on 1998-07-28
3
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

696 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