I have the following piece of code:
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
ep = new IPEndPoint(Dns.GetHostEntry(ipAddress).AddressList, port);
catch (Exception ex)
if (socket != null && socket.Connected)
throw new FtpException("Can't connect to remote server", ex.Message);
When my conenction to the internet is busy, such as when downloading, the code above throws the exception. Is there anything I can do to remedy this? try again? different port? I don't know that much about sockets, so I'm at a loss here.