Example #1
0
 public NetworkConnectionManager(RhmsCollectingServer server)
 {
     _isRequestShutdown = false;
     _collectingServer  = server;
     _networkClient     = new NetworkClient(server, this);
     _networkThread     = new Thread(WorkerUpdateNetworkThread);
 }
Example #2
0
        public NetworkClient(RhmsCollectingServer server, NetworkConnectionManager connectionManager)
        {
            _connectionManager = connectionManager;
            _collectingServer  = server;
            _peerControlHost   = _collectingServer.GetSettings().PeerSignalServer.Host;
            _apiAccessKey      = _collectingServer.GetSettings().ApiAccessKey;

            var sourceBindAddress = _collectingServer.GetSettings().BindAddress;

            if (!IPAddress.TryParse(sourceBindAddress, out var bindIpAddress))
            {
                bindIpAddress = IPAddress.Parse(RhmsSettings.Default.BindAddress);
                Logger.Warn($"Invalid IP address specified in settings '{sourceBindAddress}', using default '{bindIpAddress}'");
            }

            _bindEp             = new IPEndPoint(bindIpAddress, 0);
            _socket             = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            _socket.SendTimeout = _socket.ReceiveTimeout = _collectingServer.GetSettings().PeerSignalServer.SocketTimeoutMs;
            _socket.Bind(_bindEp);

            if (_peerControlHost.EndsWith("/"))
            {
                _peerControlHost = _peerControlHost.Substring(0, _peerControlHost.Length - 1);
            }

            _natUpnpCreateLocker = new object();
            NetworkRemoteControl.ClientInstance = this;
            PacketHandler = new NetPacketHandler(server, connectionManager, this);
        }
Example #3
0
 public InfluxDbConnection(RhmsSettings.SectionInfluxDb settings, RhmsCollectingServer server)
 {
     _remoteHost        = settings.Host;
     _dbTableName       = settings.Database;
     _retention         = settings.Retention;
     _enableDebugOutput = settings.EnableDebugOutput;
     _server            = server;
 }
Example #4
0
 public NetPacketHandler(RhmsCollectingServer server, NetworkConnectionManager connectionManager, NetworkClient netClient) {
     _collectingServer = server;
 }