JAVA串口编程如何发送字符串和接受字符串

这是我的代码
if(e.getSource()==btnOpen) {
String om;
om=out_message.getText().trim();
System.out.print(om);
try {
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
}
catch (UnsupportedCommOperationException eee) { }
try {
outputStream.writeUTF(om);
}
catch (IOException ee) { }
try{
String s=inputStream.readUTF();
out.setText(s);
}
catch(IOException e3){}
}

第1个回答  2013-08-18
apache mina 有很的串的封装,,,
第2个回答  2013-08-12
不是写的挺好的么
相似回答