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.

  • And the code running on another computer (server) can show? - Alexey Sarovsky
  • @ Alexey Sarovsky, but there is no such code. Should he be? - Maxim
  • where do you want to connect then? Who should you answer? Google - 1337 port - unofficially (Wikipedia writes like this) - this is the port of the WASTE p2p program. Did you count on it (what will this program answer)? Or just chosen. If so, then there is no one to answer you. - Alexey Sarovsky

0