Executes a commando that result in a communication over the data port. @param[in] crDatachannelCmd Command to be executeted. @param[in] strPath Parameter for the command usually a path. @param[in] representation see documentation of CFTPClient::CRepresentation @param[in] fPasv see documentation of CFTPClient::Passive @param[in] dwByteOffset Server marker at which file transfer is to be restarted.
| 877 | /// @param[in] dwByteOffset Server marker at which file transfer is to be restarted. |
| 878 | /// @param[in] Observer Object for observing the execution of the command. |
| 879 | bool CFTPClient::ExecuteDatachannelCommand(const CCommand& crDatachannelCmd, const tstring& strPath, const CRepresentation& representation, |
| 880 | bool fPasv, DWORD dwByteOffset, ITransferNotification& Observer) const |
| 881 | { |
| 882 | if( !crDatachannelCmd.IsDatachannelCommand() ) |
| 883 | { |
| 884 | ASSERT(false); |
| 885 | return false; |
| 886 | } |
| 887 | |
| 888 | if( m_fTransferInProgress ) |
| 889 | return false; |
| 890 | |
| 891 | if( !IsConnected() ) |
| 892 | return false; |
| 893 | |
| 894 | // transmit representation to server |
| 895 | if( RepresentationType(representation)!=FTP_OK ) |
| 896 | return false; |
| 897 | |
| 898 | std::unique_ptr<IBlockingSocket> apSckDataConnection(m_apSckControlConnection->CreateInstance()); |
| 899 | |
| 900 | if( fPasv ) |
| 901 | { |
| 902 | if( !OpenPassiveDataConnection(*apSckDataConnection, crDatachannelCmd, strPath, dwByteOffset) ) |
| 903 | return false; |
| 904 | } |
| 905 | else |
| 906 | { |
| 907 | if( !OpenActiveDataConnection(*apSckDataConnection, crDatachannelCmd, strPath, dwByteOffset) ) |
| 908 | return false; |
| 909 | } |
| 910 | |
| 911 | const bool fTransferOK = TransferData(crDatachannelCmd, Observer, *apSckDataConnection); |
| 912 | |
| 913 | apSckDataConnection->Close(); |
| 914 | |
| 915 | // get response from FTP server |
| 916 | CReply Reply; |
| 917 | if( !fTransferOK || !GetResponse(Reply) || !Reply.Code().IsPositiveCompletionReply() ) |
| 918 | return false; |
| 919 | |
| 920 | return true; |
| 921 | } |
| 922 | |
| 923 | /// Executes a commando that result in a communication over the data port. |
| 924 | /// @param[in] crDatachannelCmd Command to be executeted. |
nothing calls this directly
no test coverage detected