Esempio n. 1
0
        public PollingServer(IServerNetworkLinkLayer networkLinkLayer, IProtocolSpecification <TClientControlFrameType, TClientDataFrameType, TServerDataFrameType> specification)
        {
            if (networkLinkLayer == null)
            {
                throw new ArgumentNullException("networkLinkLayer", "Logical Link Layer is not set!");
            }

            if (specification == null)
            {
                throw new ArgumentNullException("specification", "Protocol-Specification cannot be null!");
            }

            if (specification.ClientEncoder == null)
            {
                throw new ArgumentException("specification", string.Format("ClientEncoder must be provided for given ProtocolSpecification '{0}'", specification.GetType().Name));
            }

            if (specification.ServerEncoder == null)
            {
                throw new ArgumentException("specification", string.Format("ServerEncoder must be provided for given ProtocolSpecification '{0}'", specification.GetType().Name));
            }

            this.protocolSpecification = specification;

            this.networkLinkLayer = networkLinkLayer;
            this.encoder          = specification.ClientEncoder;
            this.decoder          = specification.ServerEncoder;

            this.maxOutgoingSequenceValue = specification.MaxServerSequenceValue;
            this.maxIncomingSequenceValue = specification.MaxClientSequenceValue;

            this.networkLinkLayer.PollHandler = this.NetworkLayerPollHandler;
        }
Esempio n. 2
0
        public PollingClient(IClientNetworkLinkLayer clientNetworkLinkLayer, IProtocolSpecification <TClientControlFrameType, TClientDataFrameType, TServerDataFrameType> specification)
        {
            if (clientNetworkLinkLayer == null)
            {
                throw new ArgumentNullException("clientNetworkLinkLayer", "Logical Link Layer is not set!");
            }

            if (specification == null)
            {
                throw new ArgumentNullException("specification", "Protocol-Specification cannot be null!");
            }

            if (specification.ClientEncoder == null)
            {
                throw new ArgumentException("specification", string.Format("ClientEncoder must be provided for given specification '{0}'", specification.GetType().Name));
            }

            if (specification.ServerEncoder == null)
            {
                throw new ArgumentException("specification", string.Format("ServerEncoder must be provided for given specification '{0}'", specification.GetType().Name));
            }

            this.protocolSpecification = specification;

            this.transportLayer = new ClientTransportLayer <TClientControlFrameType, TClientDataFrameType, TServerDataFrameType>(
                clientNetworkLinkLayer,
                specification.ClientEncoder,
                specification.ServerEncoder,
                specification.MaxClientSequenceValue,
                specification.MaxServerSequenceValue);

            this.transportLayer.FrameReceived += TransportLayerOnFrameReceived;

            this.InitialPollingPoolSize = 4;

            this.receivedDataTimeoutTimer = new Timer(this.ReceivedDataTimeoutTimerCallback);
            this.sendKeepAlivePacketTimer = new Timer(SendKeepAlivePacketTimerCallback);
        }
Esempio n. 3
0
 public TestPollingClient(IClientNetworkLinkLayer clientNetworkLinkLayer, IProtocolSpecification <ClientControlFrame, ClientDataFrame, ServerDataFrame> specification)
     : base(clientNetworkLinkLayer, specification)
 {
 }