Task listenProcess() => Task.Run(() => { Log.RecordEvent(this, $"TCP/IP listener started on port {l.LocalPort}.", LogEntrySeverity.Info); var n = new EncryptionNegotiator(); while (process) { var s = l.Accept(); new ErebusLink(n.Negotiate(new SplitStream(s.InputStream, s.OutputStream)), ei, true); } });
Task listenProcess() => Task.Run(() => { l.Start(); Log.RecordEvent(this, $"TCP/IP listener started on port {((IPEndPoint)l.LocalEndpoint).Port}.", LogEntrySeverity.Info); var n = new EncryptionNegotiator(); while (process) { try { var c = l.AcceptTcpClient(); Log.RecordEvent(this, $"Received TCPIP connection request from {c.Client.RemoteEndPoint}.", LogEntrySeverity.Info); new ErebusLink(n.Negotiate(c.GetStream()), ei, true); } catch (Exception e) { Log.RecordEvent(this, $"Exception while setting up incoming TCPIP connection request: {e.Message}", LogEntrySeverity.Error); } } });