Exemplo n.º 1
0
        public UdpOutputChannel(
            ChannelManagerBase factory,
            MessageEncoder encoder,
            BufferManager bufferManager,
            UdpSocket[] sendSockets,
            UdpRetransmissionSettings retransmissionSettings,
            Uri via,
            bool isMulticast)
            : base(factory)
        {
            Fx.Assert(encoder != null, "encoder shouldn't be null");
            Fx.Assert(bufferManager != null, "buffer manager shouldn't be null");
            Fx.Assert(sendSockets != null, "sendSockets can't be null");
            Fx.Assert(sendSockets.Length > 0, "sendSockets can't be empty");
            Fx.Assert(retransmissionSettings != null, "retransmissionSettings can't be null");
            Fx.Assert(via != null, "via can't be null");

            this.BufferManager      = bufferManager;
            this.IsMulticast        = isMulticast;
            this.Encoder            = encoder;
            this.retransmitSettings = retransmissionSettings;
            this.SendSockets        = sendSockets;
            this.via = via;

            if (this.retransmitSettings.Enabled)
            {
                this.retransmitList        = new Dictionary <UniqueId, IUdpRetransmitter>();
                this.randomNumberGenerator = new SynchronizedRandom(AppDomain.CurrentDomain.GetHashCode() | Environment.TickCount);
            }
        }
        internal bool IsMatch(UdpRetransmissionSettings udpRetransmissionSettings)
        {
            if (this.DelayLowerBound != udpRetransmissionSettings.DelayLowerBound)
            {
                return(false);
            }

            if (this.DelayUpperBound != udpRetransmissionSettings.DelayUpperBound)
            {
                return(false);
            }

            if (this.MaxDelayPerRetransmission != udpRetransmissionSettings.MaxDelayPerRetransmission)
            {
                return(false);
            }

            if (this.MaxMulticastRetransmitCount != udpRetransmissionSettings.MaxMulticastRetransmitCount)
            {
                return(false);
            }

            if (this.MaxUnicastRetransmitCount != udpRetransmissionSettings.MaxUnicastRetransmitCount)
            {
                return(false);
            }

            return(true);
        }
 internal void ApplyConfiguration(UdpRetransmissionSettings udpRetransmissionSettings)
 {
     udpRetransmissionSettings.DelayLowerBound = this.DelayLowerBound;
     udpRetransmissionSettings.DelayUpperBound = this.DelayUpperBound;
     udpRetransmissionSettings.MaxDelayPerRetransmission = this.MaxDelayPerRetransmission;
     udpRetransmissionSettings.MaxMulticastRetransmitCount = this.MaxMulticastRetransmitCount;
     udpRetransmissionSettings.MaxUnicastRetransmitCount = this.MaxUnicastRetransmitCount;
 }
 internal UdpTransportBindingElement(UdpTransportBindingElement other)
     : base(other)
 {
     this.duplicateMessageHistoryLength = other.duplicateMessageHistoryLength;
     this.maxPendingMessagesTotalSize   = other.maxPendingMessagesTotalSize;
     this.retransmissionSettings        = other.retransmissionSettings.Clone();
     this.socketReceiveBufferSize       = other.socketReceiveBufferSize;
     this.timeToLive           = other.timeToLive;
     this.MulticastInterfaceId = other.MulticastInterfaceId;
 }
        public UdpTransportBindingElement()
            : base()
        {
            this.duplicateMessageHistoryLength = UdpConstants.Defaults.DuplicateMessageHistoryLength;
            this.maxPendingMessagesTotalSize   = UdpConstants.Defaults.DefaultMaxPendingMessagesTotalSize;

            this.retransmissionSettings  = new UdpRetransmissionSettings();
            this.socketReceiveBufferSize = UdpConstants.Defaults.SocketReceiveBufferSize;
            this.timeToLive = UdpConstants.Defaults.TimeToLive;
        }
        internal void InitializeFrom(UdpRetransmissionSettings udpRetransmissionSettings)
        {
            if (udpRetransmissionSettings == null)
            {
                throw FxTrace.Exception.ArgumentNull("udpRetransmissionSettings");
            }

            this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.DelayLowerBound, udpRetransmissionSettings.DelayLowerBound);
            this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.DelayUpperBound, udpRetransmissionSettings.DelayUpperBound);
            this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxDelayPerRetransmission, udpRetransmissionSettings.MaxDelayPerRetransmission);
            this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxMulticastRetransmitCount, udpRetransmissionSettings.MaxMulticastRetransmitCount);
            this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxUnicastRetransmitCount, udpRetransmissionSettings.MaxUnicastRetransmitCount);
        }
Exemplo n.º 7
0
 protected UdpDuplexChannel(
     ChannelManagerBase channelMananger,
     MessageEncoder encoder,
     BufferManager bufferManager,
     UdpSocket[] sendSockets,
     UdpRetransmissionSettings retransmissionSettings,
     long maxPendingMessagesTotalSize,
     EndpointAddress localAddress,
     Uri via,
     bool isMulticast,
     int maxReceivedMessageSize)
     : base(channelMananger, encoder, bufferManager, sendSockets, retransmissionSettings, maxPendingMessagesTotalSize, localAddress, via, isMulticast, maxReceivedMessageSize)
 {
 }
Exemplo n.º 8
0
        protected UdpChannelBase(
            ChannelManagerBase channelManager,
            MessageEncoder encoder,
            BufferManager bufferManager,
            UdpSocket[] sockets,
            UdpRetransmissionSettings retransmissionSettings,
            long maxPendingMessagesTotalSize,
            EndpointAddress localAddress,
            Uri via,
            bool isMulticast,
            int maxReceivedMessageSize)
            : base(channelManager)
        {
            Fx.Assert(encoder != null, "encoder shouldn't be null");
            Fx.Assert(bufferManager != null, "buffer manager shouldn't be null");
            Fx.Assert(sockets != null, "sendSockets can't be null");
            Fx.Assert(sockets.Length > 0, "sendSockets can't be empty");
            Fx.Assert(retransmissionSettings != null, "retransmissionSettings can't be null");
            Fx.Assert(maxPendingMessagesTotalSize >= 0, "maxPendingMessagesTotalSize must be >= 0");
            Fx.Assert(maxReceivedMessageSize > 0, "maxReceivedMessageSize must be > 0");
            Fx.Assert(localAddress != null, "localAddress can't be null");
            Fx.Assert(via != null, "via can't be null");

            this.maxPendingMessagesTotalSize = maxPendingMessagesTotalSize == UdpConstants.Defaults.DefaultMaxPendingMessagesTotalSize ? UdpConstants.Defaults.MaxPendingMessagesTotalSize : maxPendingMessagesTotalSize;
            this.Encoder                = encoder;
            this.Sockets                = sockets;
            this.BufferManager          = bufferManager;
            this.retransmitSettings     = retransmissionSettings;
            this.IsMulticast            = isMulticast;
            this.DuplicateDetector      = null;
            this.ReceiveManager         = null;
            this.OwnsBufferManager      = false;
            this.maxReceivedMessageSize = maxReceivedMessageSize;
            this.LocalAddress           = localAddress;
            this.via = via;
        }
 public ServerUdpOutputChannel(ChannelManagerBase factory, MessageEncoder encoder, BufferManager bufferManager, UdpSocket[] sendSockets, UdpRetransmissionSettings retransmissionSettings, Uri via, bool isMulticast)
     : base(factory, encoder, bufferManager, sendSockets, retransmissionSettings, via, isMulticast)
 {
 }
        public ClientUdpOutputChannel(ChannelManagerBase factory, IPEndPoint remoteEndPoint, MessageEncoder encoder, BufferManager bufferManager, UdpSocket[] sendSockets, UdpRetransmissionSettings retransmissionSettings, EndpointAddress to, Uri via, bool isMulticast)
            : base(factory, encoder, bufferManager, sendSockets, retransmissionSettings, via, isMulticast)
        {
            Fx.Assert(to != null, "to address can't be null for this constructor...");
            Fx.Assert(remoteEndPoint != null, "remoteEndPoint can't be null");

            this.RemoteEndPoint = remoteEndPoint;
            this.to             = to;
        }
Exemplo n.º 11
0
 UdpRetransmissionSettings(UdpRetransmissionSettings other)
     : this(other.maxUnicastRetransmitCount, other.maxMulticastRetransmitCount, other.delayLowerBound, other.delayUpperBound, other.maxDelayPerRetransmission)
 {
 }
 UdpRetransmissionSettings(UdpRetransmissionSettings other)
     : this(other.maxUnicastRetransmitCount, other.maxMulticastRetransmitCount, other.delayLowerBound, other.delayUpperBound, other.maxDelayPerRetransmission)
 {
 }
        internal bool IsMatch(UdpRetransmissionSettings udpRetransmissionSettings)
        {
            if (this.DelayLowerBound != udpRetransmissionSettings.DelayLowerBound)
            {
                return false;
            }

            if (this.DelayUpperBound != udpRetransmissionSettings.DelayUpperBound)
            {
                return false;
            }

            if (this.MaxDelayPerRetransmission != udpRetransmissionSettings.MaxDelayPerRetransmission)
            {
                return false;
            }

            if (this.MaxMulticastRetransmitCount != udpRetransmissionSettings.MaxMulticastRetransmitCount)
            {
                return false;
            }

            if (this.MaxUnicastRetransmitCount != udpRetransmissionSettings.MaxUnicastRetransmitCount)
            {
                return false;
            }

            return true;
        }
Exemplo n.º 14
0
 public ServerUdpOutputChannel(ChannelManagerBase factory, MessageEncoder encoder, BufferManager bufferManager, UdpSocket[] sendSockets, UdpRetransmissionSettings retransmissionSettings, Uri via, bool isMulticast)
     : base(factory, encoder, bufferManager, sendSockets, retransmissionSettings, via, isMulticast)
 {
 }