/* * main */ int main(int argc, char* argv[]) { setcolor( enumCyanonBlack ); cout << "Welcome to the example that it can be to test relay server." << endl << endl; setcolor( enumDefault ); IClient *pClient = NULL; pfnCreateClientInterface pFactroyFun = (pfnCreateClientInterface)g_theRainbowDll.GetProcAddress("CreateInterface"); IClientFactory *pClientFactory = NULL; ASSERT(pFactroyFun); if (SUCCEEDED(pFactroyFun(IID_IClientFactory, reinterpret_cast< void ** >(&pClientFactory)))) { pClientFactory->SetEnvironment(8192); pClientFactory->CreateClientInterface(IID_IESClient, reinterpret_cast< void ** >(&pClient )); pClientFactory->Release(); } ASSERT(pClient); pClient->Startup(); pClient->RegisterMsgFilter( reinterpret_cast< void * >( pClient ), ClientEventNotify ); //cout << "Relay Server IP: "; string relayip = "192.168.20.15"; //cin >> relayip; if ( FAILED( pClient->ConnectTo( relayip.c_str(), 7777 ) ) ) { cout << "To connect the account server is failed!" << endl; exit( -1 ); } IClient *pClonClient = NULL; pClient->QueryInterface( IID_IESClient, reinterpret_cast< void ** >( &pClonClient ) ); unsigned int threadID = 0; HANDLE hThread = (HANDLE)::_beginthreadex(0, 0, ThreadFunction, ( void * )pClonClient, 0, &threadID ); ASSERT( hThread ); SAFE_CLOSEHANDLE( hThread ); //m_theTaskEvent.Wait(); /* * System command */ _TRY_AGAIN: if (argc == 1) { string sInfo; cout << "Command:" << endl; cin >> sInfo; if (0 == sInfo.compare( "relayto" )) { cout << "IP:"; string sip; cin >> sip; cout << "id:"; unsigned long id; cin >> id; for (int i = 0; i < 1000; i++) RelayTo(pClient, inet_addr(sip.c_str()), id); }