public void Run()
{
WNSAuthentication.Instance.AuthenticateWithWNS();
Logger.Info($"Starting TCP listener on port {Port}");
var listener = new TcpListener(IPAddress.Any, Port);
listener.Start();
Logger.Info($"Starting heartbeat timer with interval {_heartBeatTimer.Interval}");
_heartBeatTimer.Start();
Task.Run(async () =>
{
while (true)
{
try
{
HandleNewConnection(await listener.AcceptTcpClientAsync());
}
catch (Exception ex)
{
Logger.Fatal("Exception occred when creating a new client session", ex);
}
}
});
}