[NTLUG:Discuss] serial communications

Stephen Davidson gorky at freenet.carleton.ca
Sat Nov 13 12:22:17 CST 2004


Hi Paul.

I ran into an issue where that package did not work on Linux > 2.2 (or 
maybe 2.0?).  Solved it by writing a primitive JNI wrapper for the 
serial port itself (basically, made a Stream Implementation or a channel 
implementation for the port - I forget now), then using straight Java 
Calls on the app side.  The App thought it was talking to a Java Stream 
channel.  I am willing to redo and Open Source this solution if needed.  
It only took me a couple of hours to knock out the first time.  And I 
probably will need it again in the future.  The old propietary code was 
pre JDK 1.4 anyways, so it should have an update/overhaul if it were to 
be published (which I doubt the owners would agree to).  It was also not 
an implementation of the java.comm package.  Bottom line, if I did in 
1.4, it would have to be a "clean implementation", so there would be no 
issues with a previous work that I have done.

Regards,
Steve

Paul Ingendorf wrote:

>It can be made non blocking in java by spawning a send thread and receive
>thread and creating the appropriate event listener to handle an event thrown
>by the receive thread to handle incoming data. You can get javax.comm from
>java.sun.com it has an example of a simpleReader/Writer in it.  With that
>you can eliminate the need for the c code and I'm sure by eliminating the
>need to multiple disciplines in what your doing it will be a little easier
>to get to where you want with it.
>
>  
>
-- 
Java/J2EE Developer/Integrator
Stephen Davidson and Associates, Inc.
Past Chair, Dallas/FortWorth J2EE Sig
214-724-7741





More information about the Discuss mailing list