Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ExitGames.Net.Sockets.Pgm.PgmSocketReceiver"/> class.
 /// </summary>
 /// <param name="ip">The ip.</param>
 /// <param name="port">The port.</param>
 /// <param name="batchedSender">The batched sender.</param>
 /// <param name="receiveInterfaces">The receive Interfaces.</param>
 public PgmSocketReceiver(string ip, int port, bool batchedSender, params string[] receiveInterfaces)
 {
     SocketReceiver          = new PgmReceiver(ip, port);
     PooledReceiver          = new PooledReceiver(SocketReceiver, batchedSender);
     PooledReceiver.Receive += new EventHandler <SocketReceiveEventArgs>(SocketReceiver_OnReceive);
     if (receiveInterfaces != null)
     {
         foreach (string str in receiveInterfaces)
         {
             if (!string.IsNullOrEmpty(str))
             {
                 IPAddress address;
                 if (IPAddress.TryParse(str, out address))
                 {
                     SocketReceiver.ReceiveInterfaces.Add(address);
                 }
                 else
                 {
                     IPHostEntry entry = Dns.GetHostEntry(str);
                     foreach (IPAddress address2 in entry.AddressList)
                     {
                         SocketReceiver.ReceiveInterfaces.Add(address2);
                     }
                 }
             }
         }
     }
     SocketReceiver.Start();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ExitGames.Net.Sockets.Pgm.PgmReceiver.AsyncPgmSocketReceiver"/> class.
 /// </summary>
 /// <param name="pgmReceiver">The parent pgm receiver.</param>
 /// <param name="socket">The socket.</param>
 /// <param name="bufferSize">The buffer size.</param>
 internal AsyncPgmSocketReceiver(PgmReceiver pgmReceiver, Socket socket, int bufferSize)
     : base(socket, bufferSize)
 {
     this.pgmReceiver = pgmReceiver;
 }