本文整理汇总了C++中GetResponse函数的典型用法代码示例。如果您正苦于以下问题:C++ GetResponse函数的具体用法?C++ GetResponse怎么用?C++ GetResponse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetResponse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetResponse
void NodeJSSocket::ProcessInputBuffer()
{
if(m_firstTimeConnected) {
m_firstTimeConnected = false;
// Apply breakpoints
m_debugger->SetBreakpoints();
// When an uncaught exception is thrown, break
m_debugger->BreakOnException();
m_inBuffer.Clear();
// Let codelite know that we have control
m_debugger->GotControl(true);
} else {
wxString buffer = GetResponse();
while(!buffer.IsEmpty()) {
JSONRoot root(buffer);
JSONElement json = root.toElement();
int reqSeq = json.namedObject("request_seq").toInt();
if(reqSeq != wxNOT_FOUND) {
std::map<size_t, NodeJSHandlerBase::Ptr_t>::iterator iter = m_handlers.find((size_t)reqSeq);
if(iter != m_handlers.end()) {
NodeJSHandlerBase::Ptr_t handler = iter->second;
handler->Process(m_debugger, buffer);
m_handlers.erase(iter);
}
if(json.hasNamedObject("running") && !json.namedObject("running").toBool()) {
wxString responseCommand = json.namedObject("command").toString();
m_debugger->GotControl((m_noBacktraceCommands.count(responseCommand) == 0));
} else {
m_debugger->SetCanInteract(false);
}
} else {
// Notify the debugger that we got control
if((json.namedObject("type").toString() == "event")) {
if(json.namedObject("event").toString() == "break") {
// breakpoint hit, notify we got control + request for backtrace
m_debugger->GotControl(true);
} else if(json.namedObject("event").toString() == "exception") {
JSONElement body = json.namedObject("body");
NodeJSDebuggerException exc;
exc.message = body.namedObject("exception").namedObject("text").toString();;
exc.line = body.namedObject("sourceLine").toInt();
exc.script = body.namedObject("script").namedObject("name").toString();
exc.column = body.namedObject("sourceColumn").toInt();
// the vm execution stopped due to an exception
m_debugger->ExceptionThrown(exc);
}
} else {
m_debugger->SetCanInteract(false);
}
}
// Check to see if we got more reponses in the in-buffer
buffer = GetResponse();
}
}
}
示例2: while
void WiFly::SendHTTPResponse(char* value){
int delayW=500;
bool success = false;
char serverBuffer[500];
char responseArr[128];
Serial.println("sendreponse");
while(!EnterCommandMode())
{
Serial.println("failed to enter cmd mode..");
}
delay(delayW);
Serial.println("open www.raaj.homeip.net 80"); uart.flush();
uart.println("open www.raaj.homeip.net 80"); //delay(delayW); //getBufferResponse();
//uart.flush();
// wait for open => TODO: loop and set timeout
unsigned long startTime = millis();
while (millis() - startTime < 6000 || success){
GetResponse(serverBuffer);
if(serverBuffer == "*OPEN*") success = true;
else delay(WIFLY_DEFAULT_DELAY);
}
if(success = false){
Serial.println("timed out on opening server port..");
return;
}
Serial.println("port open");
delay(2000);
char* response="GET /addtoDB.php?count=";
responseArr[0] = '\0';
strcat(responseArr, response);
strcat(responseArr, value);
uart.print(responseArr);
success = false;
while (millis() - startTime < 8000 || success){
GetResponse(serverBuffer);
if(serverBuffer[0] == '(') success = true;
else delay(WIFLY_DEFAULT_DELAY);
}
if(success = false){
Serial.println("failed to get '(' character..");
return;
}
Serial.println("test success!");
uart.println("exit");
}
示例3: gethostname
BOOL CHwSMTP::SendEmail()
{
BOOL bRet = TRUE;
char szLocalHostName[64] = {0};
gethostname ( (char*)szLocalHostName, sizeof(szLocalHostName) );
// hello,握手
CString str;
str.Format(_T("HELO %s\r\n"), GetCompatibleString(szLocalHostName,FALSE));
if ( !Send ( str ))
{
return FALSE;
}
if ( !GetResponse ( _T("250") ) )
{
return FALSE;
}
// 身份验证
if ( m_bMustAuth && !auth() )
{
return FALSE;
}
// 发送邮件头
if ( !SendHead() )
{
return FALSE;
}
// 发送邮件主题
if ( !SendSubject() )
{
return FALSE;
}
// 发送邮件正文
if ( !SendBody() )
{
return FALSE;
}
// 发送附件
if ( !SendAttach() )
{
return FALSE;
}
// 结束邮件正文
if ( !Send ( CString(_T(".\r\n") ) ) ) return FALSE;
if ( !GetResponse ( _T("250") ) )
return FALSE;
// 退出发送
if ( HANDLE_IS_VALID(m_SendSock.m_hSocket) )
Send ( CString(_T("QUIT\r\n")) );
m_bConnected = FALSE;
return bRet;
}
示例4: Lock
void Query::Run()
{
m_Response.Clear();
Time::Timer timer;
unsigned int iLastData = 0;
try
{
Lock();
happyhttp::Connection conn( m_strHost.c_str(), m_iPort );
conn.setcallbacks( NULL, OnData, NULL, (void*) this );
conn.putrequest( m_strMethod.c_str(), m_strRequest.c_str() );
conn.putheader( "Accept", "*/*" );
conn.putheader( "User-Agent", "Agent:Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36" );
if ( !m_PostParams.empty() )
{
conn.putheader( "Content-Length", m_PostParams.length() );
conn.putheader( "Content-type", "application/x-www-form-urlencoded" );
}
conn.endheaders();
conn.send( (const unsigned char*) m_PostParams.c_str(), m_PostParams.length() );
Unlock();
while( conn.outstanding() )
{
conn.pump();
Bootil::Platform::Sleep( 10 );
//
// Time out connection after x seconds of no activity
//
if ( timer.Seconds() > 5 ) break;
//
// Don't time out if we got data this frame
//
if ( GetResponse().GetWritten() != iLastData )
{
timer.Reset();
iLastData = GetResponse().GetWritten();
}
}
}
catch ( happyhttp::Wobbly& e )
{
// Failed for some reason.
}
}
示例5: throw
void GISStatusMsgCommand::DoExecute() throw (GException)
{
LOG_LEVEL3("DoExecute()");
GISCommandResponse * pResponse = GetResponse();
QString oResponseData;
// Return all this due to backward compatibility for Java Application
oResponseData = QString("1234567890") // version number
+ '\0'
+ QString("1234567890") // version date
+ '\0'
+ QString("02") // display type
+ '\0'
+ QString("00") // speech processor
+ '\0'
+ QString("00") // audio sound level
+ '\0'
+ QString("00") // crind beeper level
+ '\0';
pResponse->SetData(oResponseData);
}
示例6: Command_Packet
// Turns on or off the LED backlight
// Parameter: true turns on the backlight, false turns it off
// Returns: True if successful, false if not
bool FPS_GT511C3::SetLED(bool on)
{
Command_Packet* cp = new Command_Packet();
cp->Command = Command_Packet::Commands::CmosLed;
if (on)
{
if (UseSerialDebug) Serial.println("FPS - LED on");
cp->Parameter[0] = 0x01;
}
else
{
if (UseSerialDebug) Serial.println("FPS - LED off");
cp->Parameter[0] = 0x00;
}
cp->Parameter[1] = 0x00;
cp->Parameter[2] = 0x00;
cp->Parameter[3] = 0x00;
byte* packetbytes = cp->GetPacketBytes();
SendCommand(packetbytes, 12);
Response_Packet* rp = GetResponse();
bool retval = true;
if (rp->ACK == false) retval = false;
delete rp;
delete packetbytes;
delete cp;
return retval;
};
示例7: PMI_KVS_Put
int PMI_KVS_Put( const char kvsname[], const char key[], const char value[] )
{
char buf[PMIU_MAXLINE];
int err = PMI_SUCCESS;
int rc;
/* This is a special hack to support singleton initialization */
if (PMI_initialized == SINGLETON_INIT_BUT_NO_PM) {
if (cached_singinit_inuse)
return PMI_FAIL;
rc = MPL_strncpy(cached_singinit_key,key,PMI_keylen_max);
if (rc != 0) return PMI_FAIL;
rc = MPL_strncpy(cached_singinit_val,value,PMI_vallen_max);
if (rc != 0) return PMI_FAIL;
cached_singinit_inuse = 1;
return PMI_SUCCESS;
}
rc = MPL_snprintf( buf, PMIU_MAXLINE,
"cmd=put kvsname=%s key=%s value=%s\n",
kvsname, key, value);
if (rc < 0) return PMI_FAIL;
err = GetResponse( buf, "put_result", 1 );
return err;
}
示例8: iislua_resp_get_headers
int iislua_resp_get_headers(lua_State *L)
{
auto ctx = iislua_get_http_ctx(L);
if (ctx == NULL)
{
return luaL_error(L, "context is null");
}
auto headers = ctx->GetResponse()->GetRawHttpResponse()->Headers;
lua_createtable(L, 0, headers.UnknownHeaderCount);
for (USHORT i = 0; i < HttpHeaderResponseMaximum; i++)
{
if (headers.KnownHeaders[i].pRawValue != NULL)
{
lua_pushstring(L, iislua_util_get_http_resp_header(i));
lua_pushlstring(L, headers.KnownHeaders[i].pRawValue, headers.KnownHeaders[i].RawValueLength);
lua_settable(L, -3);
}
}
for (USHORT i = 0; i < headers.UnknownHeaderCount; i++)
{
lua_pushlstring(L, headers.pUnknownHeaders[i].pName, headers.pUnknownHeaders[i].NameLength);
lua_pushlstring(L, headers.pUnknownHeaders[i].pRawValue, headers.pUnknownHeaders[i].RawValueLength);
lua_settable(L, -3);
}
return 1;
}
示例9: ResetDisplay
uint8_t OLED::Init()
{
ResetDisplay();
delay(OLED_INITDELAYMS);
Serial.write(OLED_DETECT_BAUDRATE);
GetResponse();
}
示例10: GetResponse
int RemoteCameraHttp::Capture( Image &image )
{
int content_length = GetResponse();
if ( content_length == 0 )
{
Warning( "Unable to capture image, retrying" );
return( 1 );
}
if ( content_length < 0 )
{
Error( "Unable to get response" );
Disconnect();
return( -1 );
}
switch( format )
{
case JPEG :
{
if ( !image.DecodeJpeg( buffer.extract( content_length ), content_length, colours, subpixelorder ) )
{
Error( "Unable to decode jpeg" );
Disconnect();
return( -1 );
}
break;
}
case X_RGB :
{
if ( content_length != image.Size() )
{
Error( "Image length mismatch, expected %d bytes, content length was %d", image.Size(), content_length );
Disconnect();
return( -1 );
}
image.Assign( width, height, colours, subpixelorder, buffer, imagesize );
break;
}
case X_RGBZ :
{
if ( !image.Unzip( buffer.extract( content_length ), content_length ) )
{
Error( "Unable to unzip RGB image" );
Disconnect();
return( -1 );
}
image.Assign( width, height, colours, subpixelorder, buffer, imagesize );
break;
}
default :
{
Error( "Unexpected image format encountered" );
Disconnect();
return( -1 );
}
}
return( 0 );
}
示例11: nw_extmethod
bh_error nw_extmethod(const char *name, bh_opcode opcode)
{
ArrayMan_reset_msg();
ArrayMan_add_to_payload(sizeof(bh_opcode), &opcode);
ArrayMan_add_to_payload(strlen(name)+1, (void*)name);
ArrayMan_send_payload(BH_PTC_EXTMETHOD, proxyfd);
return GetResponse(BH_PTC_EXTMETHOD);
}
示例12: FileExitOptionSaveChanges
/*
* FileExitOptionSaveChanges - exit file, giving option to save if modified
*/
bool FileExitOptionSaveChanges( file *f )
{
bool aborted = FALSE;
char buffer[MAX_STR];
#ifdef __WIN__
int resp;
vi_rc rc;
MySprintf( buffer, "\"%s\" has been modified - save changes?", f->name );
resp = MessageBox( Root, buffer, EditorName, MB_YESNOCANCEL | MB_TASKMODAL );
if( resp == IDYES ) {
rc = SaveFile( NULL, -1, -1, FALSE );
if( rc != ERR_NO_ERR ) {
MySprintf( buffer, "Error saving \"%s\"", f->name );
MessageBox( Root, buffer, EditorName, MB_OK | MB_TASKMODAL );
aborted = TRUE;
} else {
NextFileDammit();
}
} else if( resp == IDCANCEL ) {
aborted = TRUE;
} else {
NextFileDammit();
}
#else
char response[MAX_SRC_LINE];
MySprintf( buffer, "\"%s\" has been modified - save changes (yes|no|cancel)?",
f->name );
if( GetResponse( buffer, response ) == GOT_RESPONSE ) {
switch( response[0] ) {
case 0:
// if the user hit ENTER then the buffer will be
// a string of 0 chars so act as if y had been hit
case 'y':
case 'Y':
SaveAndExit( NULL );
break;
case 'n':
case 'N':
NextFileDammit();
break;
case 'c':
case 'C':
default:
aborted = TRUE;
// return( FALSE );
}
} else {
aborted = TRUE;
}
#endif
return aborted;
} /* FileOptionExitSaveChanges */
示例13: GetId
void GmTicket::SendResponse(WorldSession* session) const
{
WorldPackets::Ticket::GMTicketResponse resp;
resp.TicketID = GetId();
resp.ResponseID = 2; //TODO : research
resp.Description = GetDescription();
resp.ResponseText = GetResponse();
session->SendPacket(resp.Write());
}
示例14: OpenSocket
Client::Client(const char *host, int portNum)
{
OpenSocket();
ConnectToHost(host, portNum);
SendMsg(NetMsg(Ok, 23));
GetResponse();
Disconnect();
}
示例15: PMI_Barrier
int PMI_Barrier( void )
{
int err = PMI_SUCCESS;
if ( PMI_initialized > SINGLETON_INIT_BUT_NO_PM) {
err = GetResponse( "cmd=barrier_in\n", "barrier_out", 0 );
}
return err;
}