I have a c# socket server started on a windows server pc. This is the code that make the server start :
appServer = new AppServer();
var m_Config = new ServerConfig
{
Port = 3000,
Mode = SocketMode.Tcp,
Name = "zonedetecserveur",
TextEncoding = "UTF-8"
};
//Setup the appServer
if (!appServer.Setup(m_Config))//Setup with listening port
{
Console.WriteLine("Failed to setup!");
Console.ReadKey();
return;
}
//Try to start the appServer
if (!appServer.Start())
{
Console.WriteLine("Failed to start!");
Console.ReadKey();
return;
}
Console.WriteLine("The server started successfully, press key'q' to stop it!");
This code works on the windows server pc, and the server start properly with the message "The server started successfully, press key'q' to stop it!"
But, when I try to reach the server by using :
//Create an instance
SocketClient = new Socket(SocketType.Stream, ProtocolType.Tcp);
IPAddress _ip = IPAddress.Parse(ip);
IPEndPoint point = new IPEndPoint(_ip, 3000);
//Make connection
SocketClient.Connect(point);
The application just crash with the error
System.Net.Internals.SocketExceptionFactory.ExtendedSocketException : 'A connection attempt failed because the connected party did not respond appropriately beyond a certain duration or an established connection failed because the connecting host did not respond. [::ffff:MY_SERVER_IP]:3000'
What I have done :
- Open the port 3000 on my internet router so it can be receiving tcp things
- Disable the firewall for the server.exe (it's basically the code I showed you on a cmd)
- Trying different port
Note that when I put as an ip 127.0.0.1 and I start the server on my pc and send data to this ip it works perfectly fine.
Any help on why my server says it started but does not exist is appreciated.
Thank you