FTPClient in C#
<p>I have created one FTPClient in C#.</p>

<p>I have written one sendcommand method to send the command now i want customize it like if i pass any command it should send it like for example :</p>

<pre><code>ftpcommand.sendCommand("PASV"); // for creating new data socket connection
ftpcommand.sendCommand("NLST *");   //for returning list of files from server
</code></pre>

<p>where FTPcommand is my class name.</p>

<p>MY send method is :</p>

<pre><code>public void sendCommand(String command)
    {            
        Byte[] cmdBytes = Encoding.ASCII.GetBytes((command + "\r\n").ToCharArray());
        clientSocket.Send(cmdBytes, cmdBytes.Length, 0);
        readResponse();            
    }

    public void readResponse()
    {
        this.message = "";
        this.result = readLine();

        if (this.result.Length &gt; 3)
            this.resultCode = int.Parse(this.result.Substring(0, 3));
        else
            this.result = null;
    }

    public string readLine()
    {
        while (true)
        {
            this.bytes = clientSocket.Receive(this.buffer, this.buffer.Length, 0);
            this.message += ASCII.GetString(this.buffer, 0, this.bytes);

            if (this.bytes &lt; this.buffer.Length)
            {
                break;
            }
        }

        string[] msg = this.message.Split('\n');

        if (this.message.Length &gt; 2)
            this.message = msg[msg.Length - 2];
        else
            this.message = msg[0];

        if (this.message.Length &gt; 4 &amp;&amp; !this.message.Substring(3, 1).Equals(" ")) return this.readLine();

        return message;
    }
</code></pre>
