problem reading serialport java

I'm reading data from a serial port in Java, but I'm not getting the full data, it is splitting ten it will comes. Example: If target device writes `datas_ok`, then I get `datas_` at first read then `ok` the second time. case SerialPortEvent.DATA_AVAILABLE: try { while (inputStream.available() > 0) { numBytes = inputStream.available(); readBufferArray = new byte[numBytes]; // int readtheBytes = (int) inputStream.skip(2); int readBytes = inputStream.read(readBufferArray); one = new String(readBufferArray); System.out.println("readBytes " + one); handleFlashResponse(one); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } What's wrong?
Hmm. See stackoverflow.com/questions/348777/… I detect a homework assignment..

以上就是problem reading serialport java的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏