Good evening!
Connection through sockets does not work, please tell me, what could be the problem?
Code:
IPHostEntry host = null; host = Dns.GetHostEntry(ip_host); foreach (IPAddress address in host.AddressList) { IPEndPoint ipe = new IPEndPoint(address, 1337); Socket samp = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp); samp.Connect(ipe); if (samp.Connected) { samp.Close(); //Дальнейшее действие break; } else { continue; } }
Error: "The attempt to establish a connection was unsuccessful, because the necessary response was not received from another computer in the required time, or the already established connection was broken due to an incorrect response from an already connected computer."
The error does not seem to be in the code, but in the VPS settings. But there, I added an ip to the firewall, but it still doesn't work.