| | |
| | | # nng本地服务地址 |
| | | # server_url=tcp://192.168.20.104:8801 |
| | | server_url=tcp://192.168.20.104:7701 |
| | | server_url=tcp://192.168.20.104:8801 |
| | | #server_url=tcp://192.168.20.104:7701 |
| | | # nng远程调用地址地址 |
| | | client_url=tcp://192.168.20.104:7702 |
| | | # client_url=tcp://192.168.20.10:8802 |
| | | #client_url=tcp://192.168.20.104:7702 |
| | | client_url=tcp://192.168.20.10:8802 |
| | | |
| | | # 心跳服务器 |
| | | heart_server=tcp://192.168.20.10:5006 |
| | |
| | | printf("Be downloading...%d %%\n", nPos); |
| | | sleep(1); |
| | | } |
| | | printf("have got %d\n", nPos); |
| | | // printf("have got %d\n", nPos); |
| | | //停止下载 |
| | | if (!NET_DVR_StopGetFile(hPlayback)) |
| | | { |
| | |
| | | bRes = -1; |
| | | return bRes; |
| | | } |
| | | printf("%s\n", srcfile); |
| | | // printf("%s\n", srcfile); |
| | | if (nPos < 0 || nPos > 100) |
| | | { |
| | | printf("download err [%d]\n", NET_DVR_GetLastError()); |
| | |
| | | } |
| | | |
| | | |
| | | // Json::Value response; |
| | | // Json::Value payload; |
| | | // response["code"] = rv; |
| | | // response["msg"] = rmsg; |
| | | |
| | | // Json::Value filelist; |
| | | // for(std::string f : files) { |
| | | // filelist.append(f); |
| | | // } |
| | | // payload["filelist"] = filelist; |
| | | // response["payload"] = payload; |
| | | |
| | | Json::Value request; |
| | | request["method"] = "downloadByTimeCallBack"; |
| | | Json::Value arguments; |
| | |
| | | request["arguments"] = arguments; |
| | | std::string str = request.toStyledString(); |
| | | |
| | | std::cout << "download finished, call back" << std::endl; |
| | | std::cout << str << std::endl; |
| | | std::cout << "SENDING download finished\n" << str << std::endl; |
| | | connectAndSend(remoteUrl.c_str(), strdup(str.c_str()) ); |
| | | |
| | | return 0; |
| | |
| | | char *buf = NULL; |
| | | size_t sz; |
| | | if ((rv = nng_recv(sock, &buf, &sz, NNG_FLAG_ALLOC)) == 0) { |
| | | printf("CLIENT (%s): RECEIVED \"%s\" SURVEY REQUEST\n", name, buf); |
| | | //printf("CLIENT (%s): RECEIVED \"%s\" SURVEY REQUEST\n", name, buf); |
| | | nng_free(buf, sz); |
| | | char response[1024]; |
| | | sprintf(response, "%s-%d", name, getpid()); |
| | | printf("CLIENT (%s): SENDING SURVEY RESPONSE:%s\n", name, response); |
| | | //printf("CLIENT (%s): SENDING SURVEY RESPONSE:%s\n", name, response); |
| | | if ((rv = nng_send(sock, response, strlen(response) + 1, 0)) != 0) { |
| | | fatal("nng_send", rv); |
| | | } |
| | |
| | | end["mon"] = 4; |
| | | end["day"] = 10; |
| | | end["hour"] = 14; |
| | | end["min"] = 30; |
| | | end["min"] = 40; |
| | | end["sec"] = 0; |
| | | arguments["end"] = end; |
| | | |