Solved

Serial port & system time questions!

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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 82
servlet example 11 40
JavaFX TableView not displaying correctly 3 15
Which non-HTML GUI front end to use with Java? 3 19
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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 step-by-step guide to install VisualVM launcher in eclipse.

815 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

8 Experts available now in Live!

Get 1:1 Help Now