MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / ExecuteDatachannelCommand

Method ExecuteDatachannelCommand

deps/FtpClient/FTPClient.cpp:879–921  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
879bool 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.

Callers

nothing calls this directly

Calls 4

IsDatachannelCommandMethod · 0.80
CreateInstanceMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected