protected override void _Startup() { try { var remoteEp = new IPEndPoint(IPAddress.Parse(remoteIP), remotePort); _client = new System.Net.Sockets.TcpClient(); _client.Connect(remoteEp); InvokeRepeating(nameof(_CheckConnectionState), CONN_CHECK_INTERVAL, CONN_CHECK_INTERVAL); _packetForwardService.BindReceiver <_TcpClosePacket> ( _HandleConnectionClosedByRemote); base._Startup(); Connected.Trigger(remoteEp); } catch (Exception) { _client.Dispose(); _client = null; throw; } }