Multiple Download/Upload parallely in FTP using C#
<p>I want to do Multiple Download/Upload parallely in FTP using C# without using FTPWebRequest.
I have written my custom code and when i try to download two files simultaneously first one get download properly while second one shows size as 0 KB(it also downloads).</p>

<pre><code>public void sendCommand(String command, params string[] strfilename)
{
    if (command == "RETR ") //Downloading file from Server
    {


        FileStream output = null;
        if (!File.Exists(strfilename[0]))
        output = File.Create(strfilename[0]);

        else
        output = new FileStream(strfilename[0] , FileMode.Open);

        command = "RETR " + strfilename[0];

        Byte[] cmdBytes = Encoding.ASCII.GetBytes((command + "\r\n").ToCharArray());
        clientSocket.Send(cmdBytes, cmdBytes.Length, 0);
        Socket csocket = createDataSocket();

        DateTime timeout = DateTime.Now.AddSeconds(this.timeoutSeconds);

        while (timeout &gt; DateTime.Now)
        {
            this.bytes = csocket.Receive(buffer, buffer.Length, 0);
            output.Write(this.buffer, 0, this.bytes);

            if (this.bytes &lt;= 0)
            {
                break;
            }
        }
        //  this.BinaryMode = true;
        output.Close();

        if (csocket.Connected) csocket.Close();

        this.readResponse();
        MessageBox.Show("File Downloaded successfully");  

        else if....so on

    }
}
</code></pre>

<p>In my main method i do like this:</p>

<pre><code>ftpcommand.sendCommand("RETR ","RMSViewer.xml"); //Downloading from Server
ftpcommand.sendCommand("RETR ","cms.xml");//Downloading from Server  
</code></pre>

<p>Any code snippet....</p>
