Talk:Event Based Two Way Communication
From Rxtx
public void serialEvent(SerialPortEvent arg0) {
int data;
try
{
int len = 0;
while ( ( data = in.read()) > -1 )
{
//--------------------------------------------------
if ( data != '\n' ) {
//--------------------------------------------------
break;
}
buffer[len++] = (byte) data;
}
System.out.print(new String(buffer,0,len));
}
catch ( IOException e )
{
e.printStackTrace();
System.exit(-1);
}
}
}
i think this part of program has a mistake .it should be like this.
if(data=='\n'){
if i 'm wrong ,sorry about that.

