Ejemplo n.º 1
0
        public ClientHost(Transport tsp, string endpointData, string endpointCtl, string subscription, DirectoryInfo downloadDirectory, bool testMode, GetClientNAKStateDelegate getClientState, int networkHWM, int diskHWM, int pgmRate)
        {
            this.tsp = tsp;
            this.subscription = subscription;
            this.downloadDirectory = downloadDirectory;
            this.testMode = testMode;
            this.getClientState = getClientState;
            this.pgmRate = pgmRate;

            this.Completed = false;
            this.doLogging = new BooleanSwitch("doLogging", "Log client events", "0");

            this.portData = 12198;
            this.deviceData = endpointData;
            int idx = endpointData.LastIndexOf(':');
            if (idx >= 0)
            {
                this.deviceData = endpointData.Substring(0, idx);
                UInt32.TryParse(endpointData.Substring(idx + 1), out portData);
            }

            this.portCtl = portData + 1;
            this.deviceCtl = endpointCtl;
            idx = endpointCtl.LastIndexOf(':');
            if (idx >= 0)
            {
                this.deviceCtl = endpointCtl.Substring(0, idx);
                UInt32.TryParse(endpointCtl.Substring(idx + 1), out portCtl);
                if (portCtl == portData) portCtl = portData + 1;
            }

            this.networkHWM = networkHWM;
            this.diskHWM = diskHWM;
        }