本文整理汇总了C++中WaitForMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ WaitForMessage函数的具体用法?C++ WaitForMessage怎么用?C++ WaitForMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WaitForMessage函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DoPassive
HRESULT CClientSession::DoPutFile( const string& strSrcFile, const string& strDstFile )
{
if( !IsFileExist( strSrcFile.c_str() ) ){
return E_NOENT;
}
//step 1. request passive mode to get the data channel address
u_int nPasPort = 0;
HRESULT hRet = DoPassive( nPasPort );
if( FAILED(hRet) )return hRet;
//step 2. send the put file command.
CMessage1Param<char*>* pMsgPut = (CMessage1Param<char*>*)CMessageBase::Alloc( sizeof(CMessageBase)+strDstFile.length()+1 );
pMsgPut->Init( NCM_PUTFILE, GetAddr(), GetServAddr(), strDstFile.c_str() );
CMessageTrash trash1(pMsgPut);
m_pClntProxy->SendMessage( pMsgPut );
CMessage1Param<int>* pMsgAck = (CMessage1Param<int>*)WaitForMessage( NCF_ACK|NCM_PUTFILE );
CMessageTrash trash2(pMsgAck);
if( !pMsgAck->IsSucceeded() )return pMsgAck->GetResult();
pMsgAck->ntoh( false );
int nFileMode = pMsgAck->GetParam();
//step 3. now the server agrees on the file transfer, connect the data channel and send file
SOCKET sock_stream = OpenStream( nPasPort );
if( sock_stream==INVALID_SOCKET )return E_OPENSTREAM;
//open the data stream channel.
/* CMessageBase msg;
msg.Init( NCM_OPENSTREAM, GetAddr(), GetServAddr() );
SendMessage( sock_stream, &msg );
CMessageBase* pMsg = RecvMessage<CMessageBase>( sock_stream );
if( pMsg==NULL ){
closesocket( sock_stream );
return E_OPENSTREAM;
}
CMessageTrash trash3(pMsg);
if( pMsg->IsFailed() ){
closesocket( sock_stream );
return pMsg->GetResult();
}*/
//send the file stream
int nLen = SendFileEx( sock_stream, strSrcFile.c_str(), nFileMode );
shutdown( sock_stream, SD_BOTH );
closesocket( sock_stream );
//step 4. exchange the error code.
CMessageBase msg;
msg.Init( NCM_STREAMLENGTH, GetAddr(), GetServAddr(), nLen );
m_pClntProxy->SendMessage( &msg );
CMessageBase* pMsg = WaitForMessage( NCF_ACK|NCM_STREAMLENGTH );
CMessageTrash trash4(pMsg);
return pMsg->GetResult();
}
开发者ID:EISALab,项目名称:AMGAgroundwater,代码行数:59,代码来源:clntkel.cpp
示例2: while
void PollServerThread::run()
{
extern volatile bool gPhoneScreenSyncOn;
while ( !m_exit && gPhoneScreenSyncOn ) {
if ( !connecting() ) {
int n = WaitForMessage(m_rfbClient, 500);
if ( n < 0 ) {
m_exit = true;
break;
} else if ( n > 0 ) {
emit messageArrived();
m_lastMessageReceivedTimer.start();
} else if ( checkConnection() ) {
if ( ((ConnectionWindow *)parent())->connected() && m_lastMessageReceivedTimer.elapsed() > QVNCVIEWER_CONNPEND_TIMEOUT ) {
setCheckConnection(false);
m_rfbClient->updateRect.x = m_rfbClient->updateRect.y = 0;
m_rfbClient->updateRect.w = m_rfbClient->width;
m_rfbClient->updateRect.h = m_rfbClient->height;
SendIncrementalFramebufferUpdateRequest(m_rfbClient);
}
}
QTest::qWait(0);
} else if ( connecting() ) {
setCheckConnection(true);
qApp->processEvents(QEventLoop::AllEvents, 10);
}
}
emit connectionClosed();
}
开发者ID:SmartisanTech,项目名称:Wrench,代码行数:30,代码来源:connectionwindow.cpp
示例3: Initialize
CLStatus CLMessageLoopManager::EnterMessageLoop(void *pContext)
{
CLStatus s = Initialize();
if(!s.IsSuccess())
{
CLLogger::WriteLogMsg("In CLMessageLoopManager::EnterMessageLoop(), Initialize error", 0);
return CLStatus(-1, 0);
}
while(true)
{
CLMessage *pMsg = WaitForMessage();
if(pMsg == 0)
{
CLLogger::WriteLogMsg("In CLMessageLoopManager::EnterMessageLoop(), pMsg == 0", 0);
continue;
}
CLStatus s3 = DispatchMessage(pMsg);
delete pMsg;
if(s3.m_clReturnCode == QUIT_MESSAGE_LOOP)
break;
}
CLStatus s4 = Uninitialize();
if(!s4.IsSuccess())
{
CLLogger::WriteLogMsg("In CLMessageLoopManager::EnterMessageLoop(), Uninitialize() error", 0);
return CLStatus(-1, 0);
}
return CLStatus(0, 0);
}
开发者ID:unix1986,项目名称:universe,代码行数:35,代码来源:CLMessageLoopManager.cpp
示例4: TEST_F
/*
* Input zero speed and nonzero pose. Input same pose state and pose setpoint. Expect zero output.
*/
TEST_F(QuaternionPdControllerTest, ZeroErrorZeroOutput)
{
uranus_dp::SetControlMode srv;
srv.request.mode = ControlModes::POSITION_HOLD;
if (!modeClient.call(srv))
ROS_ERROR("Failed to call service set_control_mode. New mode POSITION_HOLD not set.");
Eigen::Vector3d p(1,2,3);
Eigen::Quaterniond q(4,5,6,7);
q.normalize();
Eigen::Vector3d v(0,0,0);
Eigen::Vector3d omega(0,0,0);
PublishState(p, q, v, omega);
PublishSetpoint(p, q);
WaitForMessage();
EXPECT_NEAR(tau(0), 0, EPSILON);
EXPECT_NEAR(tau(1), 0, EPSILON);
EXPECT_NEAR(tau(2), 0, EPSILON);
EXPECT_NEAR(tau(3), 0, EPSILON);
EXPECT_NEAR(tau(4), 0, EPSILON);
EXPECT_NEAR(tau(5), 0, EPSILON);
}
开发者ID:vortexntnu,项目名称:uranus_dp,代码行数:29,代码来源:controller_test.cpp
示例5: clientLoop
static void* clientLoop(void* data) {
rfbClient* client=(rfbClient*)data;
clientData* cd=(clientData*)client->clientData;
client->appData.encodingsString=strdup(testEncodings[cd->encodingIndex].str);
sleep(1);
rfbClientLog("Starting client (encoding %s, display %s)\n",
testEncodings[cd->encodingIndex].str,
cd->display);
if(!rfbInitClient(client,NULL,NULL)) {
rfbClientErr("Had problems starting client (encoding %s)\n",
testEncodings[cd->encodingIndex].str);
updateStatistics(cd->encodingIndex,TRUE);
return NULL;
}
while(1) {
if(WaitForMessage(client,50)>=0)
if(!HandleRFBServerMessage(client))
break;
}
free(((clientData*)client->clientData)->display);
free(client->clientData);
if(client->frameBuffer)
free(client->frameBuffer);
rfbClientCleanup(client);
return NULL;
}
开发者ID:BillTheBest,项目名称:droid-VNC-server,代码行数:28,代码来源:encodingstest.c
示例6: GetServAddr
SOCKET CClientSession::OpenStream( u_int nPasPort )
{
SOCKADDR_IN addr;
addr.sin_family = AF_INET;
addr.sin_addr = GetServAddr().m_addrHost;
addr.sin_port = htons( (u_short)nPasPort );
SOCKET sock_stream = Socket( PF_INET, SOCK_STREAM, 0 );
ASSERT( sock_stream!=INVALID_SOCKET );
//import, must retry the socket initilization a few times.
try{
if( RedundantConnect( sock_stream, addr )!=0 )throw new CSockException();
//open the data stream channel.
CMessageBase msg;
msg.Init( NCM_OPENSTREAM, GetAddr(), GetServAddr() );
SendMessage( sock_stream, &msg );
CMessageBase* pMsg = RecvMessage<CMessageBase>( sock_stream );
if( pMsg==NULL )throw new CRemoteException(E_BROKENPIPE);
CMessageTrash trash(pMsg);
if( pMsg->IsFailed() )throw new CRemoteException( pMsg->GetResult() );
}catch( ... ){
CMessageBase msg;
msg.Init( NCM_OPENSTREAM, GetAddr(), GetServAddr(), E_OPENSTREAM );
m_pClntProxy->SendMessage( &msg );
CMessageTrash trash(WaitForMessage( NCF_ACK|NCM_OPENSTREAM ) );
closesocket( sock_stream );
throw;
return INVALID_SOCKET;
}
return sock_stream;
}
开发者ID:EISALab,项目名称:AMGAgroundwater,代码行数:35,代码来源:clntkel.cpp
示例7: WaitForMessage
void UBTTaskNode::WaitForMessage(UBehaviorTreeComponent* OwnerComp, FName MessageType, int32 RequestID) const
{
if (OwnerComp)
{
WaitForMessage(*OwnerComp, MessageType, RequestID);
}
}
开发者ID:dineshone,项目名称:UnrealGameEngine,代码行数:7,代码来源:BTTaskNode.cpp
示例8: Initialize
CLStatus CLMessageLoopManager::EnterMessageLoop(void *pContext)
{
SLExecutiveInitialParameter *para = (SLExecutiveInitialParameter *)pContext;
CLStatus s = Initialize();//队列(管道,网络等对象)等的初始化工作
if(!s.IsSuccess())
{
throw "In CLMessageLoopManager::EnterMessageLoop(), Initialize() error.";
para->pNotifier->NotifyInitialFinished(false);
return CLStatus(-1,0);
}
CLStatus s1 = m_pMessageOberver->Initialize(this,para->pContext);//初始化CLMessageOberver对象,如注册不同消息的处理方法
if(!s1.IsSuccess())
{
throw "In CLMessageLoopManager::EnterMessageLoop(), m_pMessageOberver->Initialize error.";
para->pNotifier->NotifyInitialFinished(false);
return CLStatus(-1,0);
}
para->pNotifier->NotifyInitialFinished(true);
while(true)
{
CLMessage *pMsg = WaitForMessage();
CLStatus s3 = DispatchMessage(pMsg);
if(s3.m_clReturnCode == QUIT_MESSAGE_LOOP) //注意此退出返回码要与QUIT_MESSAGE_LOOP保持一致
break;
delete pMsg;
}
delete m_pMessageOberver; //所有消息处理完毕,删除消息处理方法CLMessageOberver对象
m_pMessageOberver = 0; //这里加入了赋值语句,使得m_pMessageOberver = 0,因为在本类的析构中还释放了一次,造成segmentation fault
CLStatus s4 = Uninitialize();//反初始化队列(管道,网络等对象)等
return CLStatus(0,0);
}
开发者ID:ashimidashajia,项目名称:LibExcutor,代码行数:32,代码来源:CLMessageLoopManager.cpp
示例9: main
int
main(int argc, char **argv)
{
rfbClient* client = rfbGetClient(8,3,4);
client->GotFrameBufferUpdate = HandleRect;
rfbClientRegisterExtension(&backChannel);
if (!rfbInitClient(client,&argc,argv))
return 1;
while (1) {
/* After each idle second, send a message */
if(WaitForMessage(client,1000000)>0)
HandleRFBServerMessage(client);
else if(rfbClientGetClientData(client, sendMessage))
sendMessage(client, "Dear Server,\n"
"thank you for understanding "
"back channel messages!");
}
rfbClientCleanup(client);
return 0;
}
开发者ID:979351682,项目名称:android-vnc-server,代码行数:25,代码来源:backchannel.c
示例10: TRACE
void
SystemTimeSource::ControlThread()
{
TRACE("SystemTimeSource::ControlThread() enter\n");
status_t err;
do {
err = WaitForMessage(B_INFINITE_TIMEOUT);
} while (err == B_OK || err == B_ERROR);
TRACE("SystemTimeSource::ControlThread() exit\n");
}
开发者ID:looncraz,项目名称:haiku,代码行数:10,代码来源:SystemTimeSource.cpp
示例11: GetAddr
HRESULT CClientSession::DoFileMode( int nFileMode )
{
CMessageBase msg;
msg.Init( NCM_FILEMODE, GetAddr(), GetServAddr(), nFileMode );
m_pClntProxy->SendMessage( &msg );
CMessageBase* pAck = WaitForMessage( NCF_ACK|NCM_FILEMODE );
CMessageTrash trash( pAck );
return pAck->GetResult();
}
开发者ID:EISALab,项目名称:AMGAgroundwater,代码行数:10,代码来源:clntkel.cpp
示例12: guac_vnc_wait_for_messages
/**
* Waits until data is available to be read from the given rfbClient, and thus
* a call to HandleRFBServerMessages() should not block. If the timeout elapses
* before data is available, zero is returned.
*
* @param rfb_client
* The rfbClient to wait for.
*
* @param timeout
* The maximum amount of time to wait, in microseconds.
*
* @returns
* A positive value if data is available, zero if the timeout elapses
* before data becomes available, or a negative value on error.
*/
static int guac_vnc_wait_for_messages(rfbClient* rfb_client, int timeout) {
/* Do not explicitly wait while data is on the buffer */
if (rfb_client->buffered)
return 1;
/* If no data on buffer, wait for data on socket */
return WaitForMessage(rfb_client, timeout);
}
开发者ID:songxiaobao,项目名称:incubator-guacamole-server,代码行数:25,代码来源:vnc.c
示例13: main
int main (int argc, char *argv[])
{
int i;
GdkImage *image;
rfbClientLog = GtkDefaultLog;
rfbClientErr = GtkErrorLog;
gtk_init (&argc, &argv);
/* create a dummy image just to make use of its properties */
image = gdk_image_new (GDK_IMAGE_FASTEST, gdk_visual_get_system(),
200, 100);
cl = rfbGetClient (image->depth / 3, 3, image->bpp);
cl->format.redShift = image->visual->red_shift;
cl->format.greenShift = image->visual->green_shift;
cl->format.blueShift = image->visual->blue_shift;
cl->format.redMax = (1 << image->visual->red_prec) - 1;
cl->format.greenMax = (1 << image->visual->green_prec) - 1;
cl->format.blueMax = (1 << image->visual->blue_prec) - 1;
g_object_unref (image);
cl->MallocFrameBuffer = resize;
cl->canHandleNewFBSize = TRUE;
cl->GotFrameBufferUpdate = update;
cl->GotXCutText = got_cut_text;
cl->HandleKeyboardLedState = kbd_leds;
cl->HandleTextChat = text_chat;
cl->GetPassword = get_password;
cl->GetCredential = get_credential;
show_connect_window (argc, argv);
if (!rfbInitClient (cl, &argc, argv))
return 1;
while (1) {
while (gtk_events_pending ())
gtk_main_iteration ();
i = WaitForMessage (cl, 500);
if (i < 0)
return 0;
if (i && framebuffer_allocated == TRUE)
if (!HandleRFBServerMessage(cl))
return 0;
}
gtk_main ();
return 0;
}
开发者ID:gitter-badger,项目名称:meta-cocon,代码行数:55,代码来源:gtkvncviewer.c
示例14: sizeof
HRESULT CClientSession::DoChMod( const string& strFileName, int nMode )
{
CMessage1Param<char*>* pMsg = (CMessage1Param<char*>*)CMessageBase::Alloc( sizeof(CMessageBase)+strFileName.length()+1 );
pMsg->Init( NCM_CHMOD, GetAddr(), GetServAddr(), strFileName.c_str(), nMode );
CMessageTrash trash(pMsg);
m_pClntProxy->SendMessage( pMsg );
CMessageBase* pAck = WaitForMessage( NCF_ACK|NCM_CHMOD );
CMessageTrash trash2(pAck);
return pAck->GetResult();
}
开发者ID:EISALab,项目名称:AMGAgroundwater,代码行数:11,代码来源:clntkel.cpp
示例15: TEST_F
TEST_F(AllocatorTest, Sideways)
{
Publish(0, 1, 0, 0, 0, 0);
WaitForMessage();
EXPECT_NEAR(F1, 0, MAX_ERROR);
EXPECT_TRUE(F2 < 0);
EXPECT_TRUE(F3 < 0);
EXPECT_NEAR(F4, 0, MAX_ERROR);
EXPECT_TRUE(F5 > 0);
EXPECT_TRUE(F6 > 0);
}
开发者ID:vortexntnu,项目名称:uranus_dp,代码行数:12,代码来源:allocator_test.cpp
示例16: TEST_F
TEST_F(ClosedLoopIntegrationTest, ZeroInput)
{
JoystickPublish(0,0,0,0,0,ControlModes::POSITION_HOLD);
SensorPublish(0,0,9.80665,0,0,0);
WaitForMessage();
EXPECT_NEAR(F_A, 0, MAX_ERROR);
EXPECT_NEAR(F_B, 0, MAX_ERROR);
EXPECT_NEAR(F_C, 0, MAX_ERROR);
EXPECT_NEAR(F_D, 0, MAX_ERROR);
EXPECT_NEAR(F_E, 0, MAX_ERROR);
EXPECT_NEAR(F_F, 0, MAX_ERROR);
}
开发者ID:vortexntnu,项目名称:uranus_dp,代码行数:13,代码来源:closed_loop_integration_test.cpp
注:本文中的WaitForMessage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论