/// <summary>
 /// Unsubscribes from reception of messages using specified <see cref="ReliableUdpSubscribeObject"/>
 /// </summary>
 /// <param name="subscribeObject"></param>
 internal void Unsubscribe(ReliableUdpSubscribeObject subscribeObject)
 {
     try
     {
         System.Threading.Monitor.Enter(m_locker);
         m_subscribers.Remove(subscribeObject);
     }
     finally
     {
         System.Threading.Monitor.Exit(m_locker);
     }
 }
 /// <summary>
 /// Subscribes for reception of <see cref="ReliableUdpMessage"/> messages
 /// </summary>
 /// <param name="callback">Сallback method to receive messages</param>
 /// <param name="messageType">Message type to receive. Use ReliableUdpMessageTypes.Any
 ///  to receive all messages that comes from specified ip endpoint </param>
 /// <param name="ipEndPoint">Defines from what IP address and port to receive messages.
 /// Set IPEndPoint.Port property in 0 for obtaining messages from any port of the specified address.
 /// Set <c>null</c> to receive messages from any ip endpoint </param>
 /// <returns><see cref="ReliableUdpSubscribeObject"/>. Represents a subscriber.</returns>
 internal ReliableUdpSubscribeObject SubscribeOnMessages(ReliableUdpMessageCallback callback,
                                                         ReliableUdpMessageTypes messageType, IPEndPoint ipEndPoint)
 {
     try
     {
         System.Threading.Monitor.Enter(m_locker);
         ReliableUdpSubscribeObject subscribe = new ReliableUdpSubscribeObject(callback, messageType, ipEndPoint);
         if (m_subscribers.Contains(subscribe))
         {
             return(m_subscribers[m_subscribers.IndexOf(subscribe)]);
         }
         m_subscribers.Add(subscribe);
         return(subscribe);
     }
     finally
     {
         System.Threading.Monitor.Exit(m_locker);
     }
 }
示例#3
0
 /// <summary>
 /// Unsubscribes from reception of messages using specified <see cref="ReliableUdpSubscribeObject"/>
 /// </summary>
 /// <param name="subscribeObject"></param>
 public void Unsubscribe(ReliableUdpSubscribeObject subscribeObject)
 {
     m_tcb.Unsubscribe(subscribeObject);
 }