System.Net.Sockets.UdpClient.AllowNatTraversal C# (CSharp) Method

AllowNatTraversal() public method

public AllowNatTraversal ( bool allowed ) : void
allowed bool
return void
        public void AllowNatTraversal(bool allowed)
        {
            _clientSocket.SetIPProtectionLevel(allowed ? IPProtectionLevel.Unrestricted : IPProtectionLevel.EdgeRestricted);
        }

Usage Example

 public UdpFactory(int port)
 {
     ListenPort = port;
     udpClient = new UdpClient(port);
     udpClient.DontFragment = false;
     udpClient.AllowNatTraversal(true);
 }
All Usage Examples Of System.Net.Sockets.UdpClient::AllowNatTraversal