This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Input Stream 0 when opening the serial port with different baud rates.  RSS feed

 
shiva sarna
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have two serial devices with different baud rates. One is the end device with baud rate 9600 and the other is the coordinator with baud rate 38400. My application is supposed to detect the connected device by sending a command.

1. I open the port with 9600 baud rate, send a command and wait for reply. If I get a reply I detect the end device.

2. If I don't get a reply I close the port and open it with 38400 baud rate, send a command and wait for a reply.

My problem is that when I open the port with one baud rate(9600), close it and then open with other baud rate(38400) my input stream is 0 even when the device is connected to the port.

AM I doing anything wrong here. I am using a RXTX library for serial communication. I tried flushing the output stream but it gives a nativeDrain Exception.

Thanks for your help in advance.

regards
Shiva
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!