improve ntrip streaming

This commit is contained in:
Morten Nielsen 2020-07-31 15:23:31 -07:00
parent b699eab194
commit f357b2423c

View file

@ -60,13 +60,21 @@ namespace SampleApp.WinDesktop
_ = Task.Run(async () =>
{
byte[] buffer = new byte[1024];
int count = 0;
while (true)
{
var count = await stream.ReadAsync(buffer);
try
{
count = await stream.ReadAsync(buffer).ConfigureAwait(false);
}
catch (System.Exception ex)
{
Debugger.Break();
}
var device = MainWindow.currentDevice;
if (device != null && device.CanWrite)
{
await device.WriteAsync(buffer, 0, count);
await device.WriteAsync(buffer, 0, count).ConfigureAwait(false);
Dispatcher.Invoke(() =>
{
ntripstatus.Text = $"Transmitted {ntripStream.Position} bytes";