0 Replies Latest reply on Aug 4, 2015 7:25 AM by evrythng

    concurrent tcp read

    evrythng

      Hi,

       

      In my demo application I connect (tcp) to cloud and create 2 threads:

      1st processes messages from cloud (subscriptions) in a loop (basically call wiced_tcp_stream_read if timeout goto start else process message and goto start)

      2nd second polls evaluation board buttons and send messages to cloud and receive replies (ack's).

       

      these two threads uses the same socket (inside the global context) for the communications and access is properly synchronized with mutex.

       

      After 2nd thread detected button pressed it sends a message, receives reply after that 1st thread continues it's work and try to read from socket but very often (but not always!!!) I receive "not connected" error.

       

      I use 3.3.1 sdk and tried lwip and netx_duo stacks but the issue remains.

       

      Are there any limitation on using sockets in different threads (or may be known bugs)?

       

      Regards,

      Ruslan