0

Hello everyone, i have one simple question. How to port forward udp port? I've successfully forwarded tcp port (that was easy), but i just can't understand how i can do this for udp port. Maybe someone can give code example?

ps i'm trying to make 2-way port forwarding ( client <-> forwarder <-> server)
pss here is code (it's only one thing that i found in google) which work only in one way (client -> forwarder -> server), i just don't know how to do it to work in 2 ways

class Program
    {
        public static UdpClient receivingUdpClient;
        public static System.Net.IPEndPoint RemoteIpEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 0);
        static UdpClient udpClient = new UdpClient();
        static System.Net.IPAddress OutputIP = System.Net.IPAddress.Parse("IP");
        static int OutputPort = 1001;
        static int InputPort = 1000;
        static Socket serverSocket;

        static void Main(string[] args)
        {
            udpClient.Connect(OutputIP, OutputPort);
            receivingUdpClient = new System.Net.Sockets.UdpClient(InputPort);
            Byte[] dgram = receivingUdpClient.Receive(ref RemoteIpEndPoint);
            udpClient.Send(dgram, dgram.Length);
            Console.ReadLine();
        }
    }
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Megalan
0

I've found it some time before, it's not that i need. I need to forward udp port without using routers or other hardware.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.