///<summary>Called when we send TYPE command.</summary> ///<param name="ar">The result of the asynchronous operation.</param> private void OnPasvConnected(IAsyncResult ar) { try { DestinationSocket.EndConnect(ar); string rq = "TYPE I\r\n"; DestinationFtpSocket.BeginSend(Encoding.ASCII.GetBytes(rq), 0, rq.Length, SocketFlags.None, new AsyncCallback(this.OnTypeQuerySent), DestinationFtpSocket); } catch { Dispose(); } }
///<summary>Called when we send the REST command.</summary> ///<param name="ar">The result of the asynchronous operation.</param> private void OnTypeQueryRecv(IAsyncResult ar) { try { int ret = DestinationFtpSocket.EndReceive(ar); if (ret == -1) { Dispose(); return; } string rq = "REST 0\r\n"; DestinationFtpSocket.BeginSend(Encoding.ASCII.GetBytes(rq), 0, rq.Length, SocketFlags.None, new AsyncCallback(this.OnRestQuerySent), DestinationFtpSocket); } catch { Dispose(); } }