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

Method SendData

deps/FtpClient/FTPClient.cpp:1065–1103  ·  view source on GitHub ↗

Sends data over a socket to the server. @param[in] Observer Object for observing the execution of the command. @param[in] sckDataConnection Socket which is used for the send action.

Source from the content-addressed store, hash-verified

1063/// @param[in] Observer Object for observing the execution of the command.
1064/// @param[in] sckDataConnection Socket which is used for the send action.
1065bool CFTPClient::SendData(ITransferNotification& Observer, IBlockingSocket& sckDataConnection) const
1066{
1067 try
1068 {
1069 m_fTransferInProgress=true;
1070
1071 int iNumWrite = 0;
1072 size_t bytesRead = 0;
1073
1074 Observer.OnPreBytesSend(&m_vBuffer.front(), m_vBuffer.size(), bytesRead);
1075
1076 while( !m_fAbortTransfer && bytesRead!=0 )
1077 {
1078 iNumWrite = sckDataConnection.Write(&(*m_vBuffer.begin()), static_cast<int>(bytesRead), mc_uiTimeout);
1079 ASSERT( iNumWrite == static_cast<int>(bytesRead) );
1080
1081 for( TObserverSet::const_iterator it=m_setObserver.begin(); it!=m_setObserver.end(); it++ )
1082 (*it)->OnBytesSent(m_vBuffer, iNumWrite);
1083
1084 Observer.OnPreBytesSend(&m_vBuffer.front(), m_vBuffer.size(), bytesRead);
1085 }
1086
1087 m_fTransferInProgress=false;
1088 if( m_fAbortTransfer )
1089 {
1090 Abort();
1091 return false;
1092 }
1093 }
1094 catch(CBlockingSocketException& blockingException)
1095 {
1096 m_fTransferInProgress=false;
1097 ReportError(blockingException.GetErrorMessage(), CCnv::ConvertToTString(__FILE__), __LINE__);
1098 sckDataConnection.Cleanup();
1099 return false;
1100 }
1101
1102 return true;
1103}
1104
1105/// Receives data over a socket from the server.
1106/// @param[in] Observer Object for observing the execution of the command.

Callers

nothing calls this directly

Calls 8

OnBytesSentMethod · 0.80
GetErrorMessageMethod · 0.80
CleanupMethod · 0.80
OnPreBytesSendMethod · 0.45
sizeMethod · 0.45
WriteMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected