0

im a total newbie at programming and i want to ask some advice in serial port coding using java and rxtx. this error "Error 0x3e3 at ..\rxtx\src\termios.c(2350): The I/O operation has been aborted because of either a thread exit or an application request." comes out but sometimes it doesn't i noticed that it comes out when im opening a serial port connection

try
            {
                System.out.println("opening port...");
                commPort = portIdentifier.open(this.getClass().getName(),2000);
                }
            catch(PortInUseException ex)
            {
                System.err.println(ex.getMessage());
                }

and when it does connect, when i set the parameters it gives me an "invalid parameter" error. this is my code for setting parameters:

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());
                    }

i've been researching about this around the net for almost 3 days now. i'm really desperate so any help will be greatly appreciated.

thanks lean

MPelletier
  • 16,256
  • 15
  • 86
  • 137

1 Answers1

0

to what is your baudRate set ???

where is serialPort set to commPort;

 if ( commPort instanceof SerialPort )
            {
                SerialPort serialPort = (SerialPort) commPort;

termios.c

if ( !SetCommState( index->hComm, &dcb ) )
    {
        report( "SetCommState error\n" );
        YACK();
        return -1;
    }
moskito-x
  • 11,832
  • 5
  • 47
  • 60