コード例 #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
ファイル: PollingClient.cs プロジェクト: orf53975/PollingTcp
 public PollingClient(IClientNetworkLinkLayer clientNetworkLinkLayer, IClientFrameEncoder <TClientControlFrameType, TClientDataFrameType> clientEncoder, FrameEncoder <TServerDataFrameType> serverEncoder, int maxClientSequenceValue,
                      int maxServerSequenceValue)
     : this(
         clientNetworkLinkLayer,
         new DefaultProtocolSpecification <TClientControlFrameType, TClientDataFrameType, TServerDataFrameType>()
 {
     ClientEncoder = clientEncoder,
     ServerEncoder = serverEncoder,
     MaxClientSequenceValue = maxClientSequenceValue,
     MaxServerSequenceValue = maxServerSequenceValue
 })
 {
 }
コード例 #3
0
        public ClientTransportLayer(IClientNetworkLinkLayer networkLayer, IClientFrameEncoder <TSendControlFrameType, TSendDataFrameType> encoder, FrameEncoder <TReceiveDataType> decoder, int maxClientSequenceValue, int maxServerSequenceValue)
        {
            this.networkLayer = networkLayer;

            this.encoder = encoder;
            this.decoder = decoder;

            this.maxClientSequenceValue = maxClientSequenceValue;

            this.incomingBuffer = new FrameBuffer <TReceiveDataType>(maxServerSequenceValue);
            this.incomingBuffer.FrameBlockReceived += this.IncomingBufferOnFrameBlockReceived;

            this.localSequenceNr = new Random((int)DateTime.UtcNow.Ticks).Next(1, maxClientSequenceValue);

            this.networkLayer.DataReceived += this.NetworkLayerOnDataReceived;
        }
コード例 #4
0
ファイル: PollingClient.cs プロジェクト: orf53975/PollingTcp
 public PollingClient(IClientNetworkLinkLayer clientNetworkLinkLayer, IClientFrameEncoder <TClientControlFrameType, TClientDataFrameType> clientEncoder, FrameEncoder <TServerDataFrameType> serverEncoder)
     : this(clientNetworkLinkLayer, new DefaultProtocolSpecification <TClientControlFrameType, TClientDataFrameType, TServerDataFrameType>() { ClientEncoder = clientEncoder, ServerEncoder = serverEncoder })
 {
 }
コード例 #5
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 })
 {
 }