/// <summary> /// Send FTP command to control channel. /// </summary> /// <param name="cmd">A <see cref="String"/> representing the command to send.</param> public void Command(string cmd) { if ((object)m_connection == null) { return; } byte[] buff = Encoding.Default.GetBytes(cmd + Environment.NewLine); NetworkStream stream = m_connection.GetStream(); m_sessionHost.OnCommandSent(cmd); stream.Write(buff, 0, buff.Length); RefreshResponse(); }
/// <summary> /// Send FTP command to control channel. /// </summary> /// <param name="cmd">A <see cref="String"/> representing the command to send.</param> public void Command(string cmd) { if ((object)m_connection == null) { return; } // If the client receives an exception when establishing a data channel, // it may not have checked for the server's response when handling the exception FlushResponses(); byte[] buff = Encoding.Default.GetBytes(cmd + Environment.NewLine); NetworkStream stream = m_connection.GetStream(); m_sessionHost.OnCommandSent(cmd); stream.Write(buff, 0, buff.Length); RefreshResponse(); }