Solved

Serial port & system time questions!

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jsp insert to database example 2 86
jboss 7.1 start up error 1 82
SequenceInputStream example 3 34
How to log java errors in tomcat 8 35
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

738 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