I am using a library called Lidgren network that handles all the network part of my application. It uses UDP.
I never had any problem with TCP applications and port forwarding (apache, FTP, SMTP, etc). I did some TCP applications using TCP and I could connect without a problem.
I am making an online game right now and I use UDP for network transmission. I port forwarded it in my router and I have it running. When I use my remote IP Address (190.136.243.40) to connect to it, I can't. When I use loopback (127.0.0.1) I can connect without any kind of problem.
I turned off Windows firewall, I rebooted the computer, but I still can't connect using my remote IP Address.
Here is part of my code:
public static class ServerInfo
{
static ServerInfo()
{
ServerAddress = Dns.GetHostAddresses("leboran.dyndns.org")[0];
}
public const short Port = 6483;
public static IPAddress ServerAddress;
public const string AppIdentifier = "UnnamedGameNet";
public static byte[] MagicByte
{
get
{
return new byte[4] { 0xF1, 0x64, 0x83, 0xC4 };
}
}
}
This is the part where I start my server, probably not important:
public void StartServer()
{
this.listenThread = new Thread(ListenForClients);
peerConfig = new NetPeerConfiguration(SharedConstants.ServerInfo.AppIdentifier);
peerConfig.Port = SharedConstants.ServerInfo.Port;
peerConfig.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
peerConfig.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
peerConfig.ConnectionTimeout = 2144124;
netServer = new NetServer(peerConfig);
listenThread.Start();
}
The port I am using is 6483. I am running a Minecraft server at port 25565 and it works perfectly, so it is not a bad configuration on the router