SetIPProtectionLevel() public method

public SetIPProtectionLevel ( IPProtectionLevel level ) : void
level IPProtectionLevel
return void
Example #1
0
        }      //new

        public void AllowNatTraversal(bool allowed)
        {
            if (allowed)
            {
                m_ClientSocket.SetIPProtectionLevel(IPProtectionLevel.Unrestricted);
            }
            else
            {
                m_ClientSocket.SetIPProtectionLevel(IPProtectionLevel.EdgeRestricted);
            }
        }
Example #2
0
        public void AllowNatTraversal(bool allowed)
        {
            if (active)
            {
                throw new InvalidOperationException(SR.GetString(SR.net_tcplistener_mustbestopped));
            }

            if (allowed)
            {
                server.SetIPProtectionLevel(IPProtectionLevel.Unrestricted);
            }
            else
            {
                server.SetIPProtectionLevel(IPProtectionLevel.EdgeRestricted);
            }
        }
Example #3
0
        public void AllowNatTraversal(bool allowed)
        {
            if (_active)
            {
                throw new InvalidOperationException(SR.net_tcplistener_mustbestopped);
            }

            _serverSocket.SetIPProtectionLevel(allowed ? IPProtectionLevel.Unrestricted : IPProtectionLevel.EdgeRestricted);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UdpConnection"/> class.
        /// </summary>
        /// <param name="udpClient">The UDP client.</param>
        /// <param name="endPoint">The endPoint where we want to receive the data.</param>
        internal UdpConnection(UdpClient udpClient, IPEndPoint remoteEndPoint, bool writeLock = false)
            : base()
        {
            client = udpClient;
            WriteLock = writeLock;
            socket = client.Client;
            ipEndPoint = remoteEndPoint;
            client.Connect(remoteEndPoint);

            KeepAlive = false;
            socket.SendTimeout = 0;
            socket.ReceiveTimeout = 0;
            socket.SetIPProtectionLevel(IPProtectionLevel.Unrestricted);

            Init();
        }
Example #5
0
        public static void Main(string[] args)
        {
            Test().Wait();

            Console.WriteLine("");
            Console.WriteLine("Socket listening on port 1602. Remember, it is mapped to external port 1702!!!");
            Console.WriteLine("Test it with http://www.canyouseeme.org/ online tool");

            var endPoint = new IPEndPoint(IPAddress.Any, 1602);
            var socket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            socket.SetIPProtectionLevel(IPProtectionLevel.Unrestricted);
            socket.Bind(endPoint);
            socket.Listen(4);

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
            socket.Close();
        }
Example #6
0
 protected override Socket CreateSocket()
 {
     var socket = new Socket(EndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
         socket.SetIPProtectionLevel(IPProtectionLevel.Unrestricted);
         socket.Bind(EndPoint);
         socket.Listen(4);
         return socket;
 }
Example #7
0
 void Utils.Wrappers.Interfaces.ISocket.SetIPProtectionLevel(System.Net.Sockets.IPProtectionLevel level)
 {
     InternalSocket.SetIPProtectionLevel(level);
 }
Example #8
0
 public void AllowNatTraversal(bool allowed)
 {
     _clientSocket.SetIPProtectionLevel(allowed ? IPProtectionLevel.Unrestricted : IPProtectionLevel.EdgeRestricted);
 }
Example #9
0
 /// <summary>
 /// Send raw packet containing 'text' to the wifilink
 /// </summary>
 /// <param name="text">contents of packet.</param>
 public void SendRaw(string text)
 {
     Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     sock.SetIPProtectionLevel(IPProtectionLevel.Unrestricted);
     sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);
     IPAddress serverAddr = IPAddress.Parse("192.168.1.8");
     IPEndPoint endPoint = new IPEndPoint(serverAddr, 9760);
     byte[] send_buffer = Encoding.ASCII.GetBytes(text);
     sock.SendTo(send_buffer, endPoint);
 }
Example #10
0
 private void SetIPProtectionLevel(bool allowed)
 => _serverSocket.SetIPProtectionLevel(allowed ? IPProtectionLevel.Unrestricted : IPProtectionLevel.EdgeRestricted);