This function gets the server response. A server response can exists of more than one line. This function returns the full response (multiline). @param[out] Reply Reply of the server to a command.
| 1187 | /// returns the full response (multiline). |
| 1188 | /// @param[out] Reply Reply of the server to a command. |
| 1189 | bool CFTPClient::GetResponse(CReply& Reply) const |
| 1190 | { |
| 1191 | tstring strResponse; |
| 1192 | if( !GetSingleResponseLine(strResponse) ) |
| 1193 | return false; |
| 1194 | |
| 1195 | if( strResponse.length()>3 && strResponse.at(3)==_T('-') ) |
| 1196 | { |
| 1197 | tstring strSingleLine(strResponse); |
| 1198 | const int iRetCode=CCnv::TStringToLong(strResponse); |
| 1199 | // handle multi-line server responses |
| 1200 | while( !(strSingleLine.length()>3 && |
| 1201 | strSingleLine.at(3)==_T(' ') && |
| 1202 | CCnv::TStringToLong(strSingleLine)==iRetCode) ) |
| 1203 | { |
| 1204 | if( !GetSingleResponseLine(strSingleLine) ) |
| 1205 | return false; |
| 1206 | strResponse += mc_strEolCharacterSequence + strSingleLine; |
| 1207 | } |
| 1208 | } |
| 1209 | |
| 1210 | bool fRet = Reply.Set(strResponse); |
| 1211 | |
| 1212 | for( TObserverSet::const_iterator it=m_setObserver.begin(); it!=m_setObserver.end(); it++ ) |
| 1213 | (*it)->OnResponse(Reply); |
| 1214 | |
| 1215 | return fRet; |
| 1216 | } |
| 1217 | |
| 1218 | /// Reads a single response line from the server control channel. |
| 1219 | /// @param[out] strResponse Response of the server as string. |
no test coverage detected