本文整理汇总了C++中CObjectOStream::Flush方法的典型用法代码示例。如果您正苦于以下问题:C++ CObjectOStream::Flush方法的具体用法?C++ CObjectOStream::Flush怎么用?C++ CObjectOStream::Flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObjectOStream
的用法示例。
在下文中一共展示了CObjectOStream::Flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetLastError
CRef< CTaxon3_reply >
CTaxon3::SendRequest(const CTaxon3_request& request)
{
SetLastError(NULL);
unsigned reconnect_attempts = 0;
while (reconnect_attempts < m_nReconnectAttempts) {
try {
auto_ptr<CObjectOStream> pOut;
auto_ptr<CObjectIStream> pIn;
auto_ptr<CConn_ServiceStream>
pServer( new CConn_ServiceStream(m_sService, fSERV_Any,
0, 0, m_timeout) );
pOut.reset( CObjectOStream::Open(m_eDataFormat, *pServer) );
pIn.reset( CObjectIStream::Open(m_eDataFormat, *pServer) );
CObjectIStream* ppIn = pIn.release();
CObjectOStream* ppOut = pOut.release();
try {
*ppOut << request;
ppOut->Flush();
ppOut->Close();
try {
CRef< CTaxon3_reply > response(new CTaxon3_reply);
*ppIn >> *response;
delete ppIn;
delete ppOut;
return response;
} catch (exception& e) {
SetLastError( e.what() );
}
} catch (exception& e) {
SetLastError( e.what() );
}
} catch( exception& e ) {
SetLastError( e.what() );
}
reconnect_attempts++;
}
// return NULL
CRef<CTaxon3_reply> reply;
return reply;
}