Ejemplo n.º 1
0
        internal void _AddHiddenClientPingChannel(int peerID)
        { //SERVERSIDE
            UDPChannel pingChannel = new UDPChannel(UDPManager._UDPMRCP + ":" + peerID, true, true, 1000, 10000);

            pingChannel.AddEventListener <UDPManagerEvent>(UDPManagerEvent._SEND_DATA, this._SendDataFromChannel);
            pingChannel.AddEventListener <UDPManagerEvent>(UDPManagerEvent.Names.DATA_DELIVERED, this._DeliveredNotifForward);
            pingChannel.AddEventListener <UDPManagerEvent>(UDPManagerEvent.Names.DATA_RETRIED, this._RetryNotifForward);
            pingChannel.AddEventListener <UDPManagerEvent>(UDPManagerEvent.Names.DATA_CANCELED, this._CancelNotifForward);
            this._clientsPingChannels.Add(pingChannel);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add a UDPChannel on the instance</summary>
 /// <param name='channelName'>The name of the channel you want to create. It must be unique on this instance, if a channel with the same name has already been added the method will throw an exception!<remarks>You can check if the name is already used by calling <see cref="GetChannelByName"/></remarks></param>
 /// <param name='guarantiesDelivery'>If true the messages sent though this channel will wait for a receipt from the target that will guaranty the delivery. It will wait during the time specified on <paramref name="retryTime"/> until what it will retry sending the message, etc... If false the message is sent once without guranty of delivery. Default is false.<remarks>The guaranty of the delivery works only if the target uses the same library (C#,AS3 or JS) to communicate over UDP!</remarks></param>
 /// <param name='maintainOrder'>If true it will wait for a message to be delivered before sending the next one.<remarks> Only works if <paramref name="guarantiesDelivery"/> is true</remarks></param>
 /// <param name='retryTime'>The number of milliseconds the channel will wait before retrying sending the message if not delivered. Default is 30.</param>
 /// <param name='cancelTime'>The number of milliseconds the channel will wait before canceling the message if not delivered. Default is 500.</param>
 public void AddChannel(string channelName, bool guarantiesDelivery = false, bool maintainOrder = false, float retryTime = 30, float cancelTime = 500)
 {
     if (this.GetChannelByName(channelName) == null)
     {
         UDPChannel channel = new UDPChannel(channelName, guarantiesDelivery, maintainOrder, retryTime, cancelTime);
         channel.AddEventListener <UDPManagerEvent>(UDPManagerEvent._SEND_DATA, this._SendDataFromChannel);
         channel.AddEventListener <UDPManagerEvent>(UDPManagerEvent.Names.DATA_DELIVERED, this._DeliveredNotifForward);
         channel.AddEventListener <UDPManagerEvent>(UDPManagerEvent.Names.DATA_RETRIED, this._RetryNotifForward);
         channel.AddEventListener <UDPManagerEvent>(UDPManagerEvent.Names.DATA_CANCELED, this._CancelNotifForward);
         this._channels.Add(channel);
     }
     else
     {
         throw new ArgumentException("channelName " + channelName + " already used");
     }
 }