Java rxtx错误0x3e3 IO操作中止,设置参数无效

Java rxtx错误0x3e3 IO操作中止,设置参数无效,java,serial-port,rxtx,Java,Serial Port,Rxtx,我是一个编程新手,我想问一些关于使用java和rxtx进行串口编码的建议。这个错误“error 0x3e3 at..\rxtx\src\termios.c(2350):由于线程退出或应用程序请求,I/O操作已被中止。”出现了,但有时我没有注意到,当我打开串行端口连接时,它出现了 try { System.out.println("opening port..."); commPort = portIdenti

我是一个编程新手,我想问一些关于使用java和rxtx进行串口编码的建议。这个错误“error 0x3e3 at..\rxtx\src\termios.c(2350):由于线程退出或应用程序请求,I/O操作已被中止。”出现了,但有时我没有注意到,当我打开串行端口连接时,它出现了

try
            {
                System.out.println("opening port...");
                commPort = portIdentifier.open(this.getClass().getName(),2000);
                }
            catch(PortInUseException ex)
            {
                System.err.println(ex.getMessage());
                }
当它连接时,当我设置参数时,它会给我一个“无效参数”错误。这是我设置参数的代码:

try
                {
                    System.out.println("setting params...");
                    this.serialPort.setSerialPortParams(
                        baudRate,
                        SerialPort.DATABITS_8,
                        SerialPort.STOPBITS_1,
                        SerialPort.PARITY_NONE);
                    this.serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
                    }
                catch(UnsupportedCommOperationException ex)
                {
                    System.err.println(ex.getMessage());
                    }
我已经在网上研究了差不多三天了。我真的很绝望,所以任何帮助都将不胜感激

谢谢
将波特率设置为多少

其中serialPort设置为commPort

 if ( commPort instanceof SerialPort )
            {
                SerialPort serialPort = (SerialPort) commPort;
termios.c

if ( !SetCommState( index->hComm, &dcb ) )
    {
        report( "SetCommState error\n" );
        YACK();
        return -1;
    }