예제 #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;
        }
예제 #2
0
 public TestPollingServer(IServerNetworkLinkLayer networkLinkLayer) :
     base(networkLinkLayer, new TestProtocolSpecification() { ClientEncoder = new BinaryClientFrameEncoder(), ServerEncoder = new BinaryServerFrameEncoder() })
 {
 }
예제 #3
0
 public TestPollingServer(IServerNetworkLinkLayer networkLinkLayer, TestProtocolSpecification specification)
     : base(networkLinkLayer, specification)
 {
 }
예제 #4
0
 public PollingServer(IServerNetworkLinkLayer networkLinkLayer, IClientFrameEncoder <TClientControlFrameType, TClientDataFrameType> encoder, FrameEncoder <TServerDataFrameType> decoder, int maxIncomingSequenceValue, int maxOutgoingSequenceValue)
     : this(networkLinkLayer, new DefaultProtocolSpecification <TClientControlFrameType, TClientDataFrameType, TServerDataFrameType>() { ClientEncoder = encoder, ServerEncoder = decoder, MaxClientSequenceValue = maxIncomingSequenceValue, MaxServerSequenceValue = maxOutgoingSequenceValue })
 {
 }