Ejemplo n.º 1
0
        /// <summary>
        /// Disposes this instance.
        /// </summary>
        /// <param name="disposing">The disposing.</param>
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                lock (disposeLock)
                {
                    if (log.IsDebugEnabled)
                    {
                        log.DebugFormat("Disposing Receiver for endpoint {0}.", listener.LocalEndPoint);
                    }

                    if (listener != null)
                    {
                        listener.AcceptSocket -= new EventHandler <SocketAsyncEventArgs>(PgmListener_OnAcceptSocket);
                        listener.Dispose();
                        listener = null;
                    }

                    lock (readerDictionary)
                    {
                        foreach (AsyncPgmSocketReceiver receiveBufferSize in readerDictionary.Values)
                        {
                            receiveBufferSize.Dispose();
                        }
                        readerDictionary.Clear();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ExitGames.Net.Sockets.Pgm.PgmReceiver"/> class.
 /// </summary>
 /// <param name="endPoint">The multicast end point.</param>
 public PgmReceiver(IPEndPoint endPoint)
 {
     listener = new PgmListener(endPoint);
     listener.AcceptSocket += new EventHandler <SocketAsyncEventArgs>(PgmListener_OnAcceptSocket);
 }