Receive() публичный Метод

public Receive ( IPEndPoint &remoteEP, string &endpoint ) : BMSByte
remoteEP System.Net.IPEndPoint
endpoint string
Результат BMSByte
Пример #1
0
		public static void RegisterNat(ref CachedUdpClient readClient, ushort port, string proxyHost = "beardedmanstudios.com", ushort proxyPort = PROXY_PORT)
		{
			readClient = new CachedUdpClient(proxyHost, proxyPort);
			IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, 0);
			//readClient.Connect(proxyHost, proxyPort);

			try
			{
				int tryCount = 30;
				while (readClient.Available == 0)
				{
					readClient.Send(new byte[1] { 1 }, 1);
					Thread.Sleep(1000);

					if (--tryCount <= 0)
						throw new Exception("Unable to contact proxy host");
				}

				string tmp = string.Empty;
				readClient.Receive(ref endpoint, ref tmp);
			}
			catch (Exception e)
			{
				Console.WriteLine(e.ToString());
			}
		}