private void DownloadFile(Url url, int choice)
{
SecurityOptions options = new SecurityOptions(SecureProtocol.None);;
m_Socket = new SecureSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp, options);
// connect to the FTP server using a normal TCP connection
m_Socket.Connect(new IPEndPoint(Dns.GetHostEntry(url.Host).AddressList[0], url.Port));
// wait for the server hello
ReceiveReply();
// if the user selected to use the AUTH command..
if (choice == 2) {
// ..send the command to the server and start the SSL handshake
DoAuthCommand(url.Host);
}
// log on and quit
if (!SendCommand("USER " + url.Username))
return;
if (!SendCommand("PASS " + url.Password))
return;
if (!SendCommand("QUIT"))
return;
// clean up
m_Socket.Shutdown(SocketShutdown.Both);
m_Socket.Close();
}