Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var keepAlive = Task.Run(async () => {
- while(!cancelSource.Token.IsCancellationRequested)
- {
- Console.WriteLine("Checking alive");
- await Task.Delay(1000);
- if(cancelSource.Token.IsCancellationRequested)
- return;
- remoteStream.WriteByte(0xFF);
- await remoteStream.FlushAsync().ConfigureAwait(false);
- Console.WriteLine($"Flushing toilet. Connection is {_remoteClient.Connected}");
- }
- }, cancelSource.Token);
- //I get in console:
- //Flushing toilet. Connection is True
- //Checking alive
- // even after turning the device off
Advertisement
Add Comment
Please, Sign In to add comment