public void Connect() { ThrowIfFail((connect = commClient.Connect(queueIn, connSectonName)) != IntPtr.Zero); commClient.SetQueue(connect, queueOut); outQueueListener = Task.Factory.StartNew(_ => ListeningFunc((CancellationToken)_), cancelSource.Token); }