rdavisau / sockets-for-pcl

Cross-platform socket API for Xamarin iOS/Android/Forms, Xamarin.Mac/MonoMac, Windows Phone 8/8.1, Windows Store and Windows Desktop.
MIT License
223 stars 72 forks source link

Keep the TCP connection open and receive the messages continuously #145

Closed thandunaresh closed 6 years ago

thandunaresh commented 6 years ago

Hello,

Not sure if it's already there but can I please check if it's possible to keep the connection open and listen for the messages on the connection?

I was thinking if open the connection and keep it open (by not calling close), it will receive the updates. Can you please advise me on this?

Thanks, Naresh

rdavisau commented 6 years ago

Yes it's correct in general that a listening socket will keep receiving messages. But depending on the platform you're running on, moving to the background may cause the connection to be broken and in that case you need to follow the application lifecycle events to work around it.