Listener for UART and Socket streams | Thales IoT Developer Community
January 27, 2017 - 9:07am, 2090 views
Is there a listener mechanism for ComConnection and/or SocketConnection data receive. In sample examples, an InputStream is opened for connection and it is checked always.
I'm using 2 separate thread to check if data is available in receive buffers of InputStreams (socket and uart streams). In a while loop, InputStream available() method is used to check if data received. Thread's run() method has an infinite while loop in it to check/read streams.
If there was a notification when a byte received like interrupt, it wouldn't be necessary to check buffer continuously.