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

Method ReceiveData

deps/FtpClient/FTPClient.cpp:1108–1149  ·  view source on GitHub ↗

Receives data over a socket from the server. @param[in] Observer Object for observing the execution of the command. @param[in] sckDataConnection Socket which is used for receiving the data.

Source from the content-addressed store, hash-verified

1106/// @param[in] Observer Object for observing the execution of the command.
1107/// @param[in] sckDataConnection Socket which is used for receiving the data.
1108bool CFTPClient::ReceiveData(ITransferNotification& Observer, IBlockingSocket& sckDataConnection) const
1109{
1110 try
1111 {
1112 m_fTransferInProgress = true;
1113
1114 for( TObserverSet::const_iterator it=m_setObserver.begin(); it!=m_setObserver.end(); it++ )
1115 (*it)->OnBeginReceivingData();
1116
1117 int iNumRead=sckDataConnection.Receive(&(*m_vBuffer.begin()), static_cast<int>(m_vBuffer.size()), mc_uiTimeout);
1118 long lTotalBytes = iNumRead;
1119 while( !m_fAbortTransfer && iNumRead!=0 )
1120 {
1121 for( TObserverSet::const_iterator it=m_setObserver.begin(); it!=m_setObserver.end(); it++ )
1122 (*it)->OnBytesReceived(m_vBuffer, iNumRead);
1123
1124 Observer.OnBytesReceived(m_vBuffer, iNumRead);
1125
1126 iNumRead=sckDataConnection.Receive(&(*m_vBuffer.begin()), static_cast<int>(m_vBuffer.size()), mc_uiTimeout);
1127 lTotalBytes += iNumRead;
1128 }
1129
1130 for( TObserverSet::const_iterator it2=m_setObserver.begin(); it2!=m_setObserver.end(); it2++ )
1131 (*it2)->OnEndReceivingData(lTotalBytes);
1132
1133 m_fTransferInProgress=false;
1134 if( m_fAbortTransfer )
1135 {
1136 Abort();
1137 return false;
1138 }
1139 }
1140 catch(CBlockingSocketException& blockingException)
1141 {
1142 m_fTransferInProgress=false;
1143 ReportError(blockingException.GetErrorMessage(), CCnv::ConvertToTString(__FILE__), __LINE__);
1144 sckDataConnection.Cleanup();
1145 return false;
1146 }
1147
1148 return true;
1149}
1150
1151/// Sends a command to the server.
1152/// @param[in] Command Command to send.

Callers

nothing calls this directly

Calls 9

OnBeginReceivingDataMethod · 0.80
ReceiveMethod · 0.80
OnEndReceivingDataMethod · 0.80
GetErrorMessageMethod · 0.80
CleanupMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
OnBytesReceivedMethod · 0.45

Tested by

no test coverage detected