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();
}
}