Exemple #1
0
void BaseRequest::onDataTail(void* ctx, int dataLength, char* data) {
    BaseRequest* request        = static_cast<BaseRequest*>(ctx);
    
    request->m_dataTail         = data;
    request->m_dataTailLength   = dataLength;
    
    request->sendStream();
}
Exemple #2
0
void BaseRequest::onDataHead(void* ctx, int dataLength, char* data) {
    BaseRequest* request        = static_cast<BaseRequest*>(ctx);
    
    if (data) {
        request->m_dataHead         = data;
        request->m_dataHeadLength   = dataLength;
    
        int initCmdLen              = 10 + strlen(request->m_target);
        char* initCmd               = new char[initCmdLen + 1];

        sprintf(initCmd, "0 INIT %s \r\n", request->m_target);
        Manager::acquireCommConnection()->cmd(initCmd, initCmdLen, request, onCommInit); 
    } else {
        request->sendStream();
    }
}