2012-04-08 2 views
0

메신저 프로그램에서 총 초보자이고 java 및 rxtx를 사용하여 직렬 포트 코딩에 대한 조언을하고 싶습니다. 이 오류 "오류 0x3e3 .. \ rxtx \ src \ termios.c (2350) : 스레드 종료 또는 응용 프로그램 요청 때문에 I/O 작업이 중단되었습니다." 나오는하지만 가끔은 내가 메신저 직렬 포트 연결rxtx 오류 0x3e3 IO 작업이 중단되었으며 잘못된 설정 매개 변수

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

저는 거의 3 일 동안이 네트에 대해 조사해 왔습니다. 나는 정말로 필사적이어서 어떤 도움도 크게 감사 할 것입니다.

덕분에 당신의 전송 속도가 설정 한 값에

답변

0

을 의지 ???

여기서 serialPort는 commPort로 설정됩니다.

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

termios.c

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