Sends a command to the server. @param[in] Command Command to send.
| 1151 | /// Sends a command to the server. |
| 1152 | /// @param[in] Command Command to send. |
| 1153 | bool CFTPClient::SendCommand(const CCommand& Command, const CArg& Arguments) const |
| 1154 | { |
| 1155 | if( !IsConnected() ) |
| 1156 | return false; |
| 1157 | |
| 1158 | try |
| 1159 | { |
| 1160 | for( TObserverSet::const_iterator it=m_setObserver.begin(); it!=m_setObserver.end(); it++ ) |
| 1161 | (*it)->OnSendCommand(Command, Arguments); |
| 1162 | const std::string strCommand = CCnv::ConvertToString(Command.AsString(Arguments)) + "\r\n"; |
| 1163 | m_apSckControlConnection->Write(strCommand.c_str(), static_cast<int>(strCommand.length()), mc_uiTimeout); |
| 1164 | } |
| 1165 | catch(CBlockingSocketException& blockingException) |
| 1166 | { |
| 1167 | ReportError(blockingException.GetErrorMessage(), CCnv::ConvertToTString(__FILE__), __LINE__); |
| 1168 | const_cast<CFTPClient*>(this)->m_apSckControlConnection->Cleanup(); |
| 1169 | return false; |
| 1170 | } |
| 1171 | |
| 1172 | return true; |
| 1173 | } |
| 1174 | |
| 1175 | /// Sends a command to the server. |
| 1176 | /// @param[in] Command Command to send. |
no test coverage detected