[Rxtx] Can't read on COM on WindowsXP and Java 1.5
Dirk Niemeier
dirk.niemeier at stueken.de
Wed May 2 08:20:22 MDT 2007
Hi again,
isn't there anybody who can help me ? I tried with EventListener too,
But I don't get any event.
regards,
Dirk
>Hi,
>I try to change from Sun Comm to RXTX but without success. I try version
>RXTX-2.1-7. I can open the SerialPort, set params and write out to port.
>But I didn't get any byte from serial port.
>
> portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
> CommPort commPort =
>portIdentifier.open(this.getClass().getName(), 2000);
> if (commPort instanceof SerialPort)
> {
> serialPort = (SerialPort) commPort;
> serialPort.setSerialPortParams(9600,
>SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
> SerialPort.PARITY_NONE);
> serialPort.addEventListener(new SerialListener());
> serialPort.notifyOnDataAvailable(true);
>
> inputStream = serialPort.getInputStream();
> outputStream = serialPort.getOutputStream();
>
> isInited = true;
>// test read
> for(;;)
> getLogger().info( inputStream.read());
>The test read always return -1. When I change back the import to
>"javax.comm.*" it works fine. The write to outputStream works fine. I
>dont know why the reading doesn't work. Any suggestions ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dirk.niemeier.vcf
Type: text/x-vcard
Size: 528 bytes
Desc: not available
URL: <http://mailman.qbang.org/pipermail/rxtx/attachments/20070502/f4e2bbc0/attachment-1668.vcf>
More information about the Rxtx
mailing list