private void Publish() { publishing = true; publisherSocket.Connect(@"tcp://127.0.0.1:17233"); while (publishing) { if (teleprinter.CachedDataAvailableEvent.WaitOne(TimeSpan.FromMilliseconds(200))) { if (!publisherSocket.TrySendFrame(teleprinter.GetCachedOutput())) { Log.Debug("Failed to send frame."); } } } }