| | |
| | | for(auto && i : topics){ |
| | | auto msg = base_cont + "test_ps pub message "+i+"-->msg"; |
| | | TestPub(i.c_str(), i.length(), msg.c_str(), msg.length()); |
| | | // printf("TestPub %s\n", msg.c_str()); |
| | | this_thread::sleep_for(chrono::milliseconds{126}); |
| | | } |
| | | } |
| | |
| | | }else{ |
| | | printf("start request %d\n", atoi(argv[1])); |
| | | bhome_msg::BHAddress addr; |
| | | addr.set_ip("192.168.20.108"); |
| | | addr.set_port(atoi(argv[1])); |
| | | // addr.set_ip("192.168.20.108"); |
| | | // addr.set_port(atoi(argv[1])); |
| | | // addr.set_ip("192.168.20.108"); |
| | | // addr.set_port(atoi(argv[1])); |
| | | |
| | | string node; |
| | | addr.SerializeToString(&node); |
| | |
| | | msg.SerializeToString(&smsg); |
| | | |
| | | // auto s = chrono::steady_clock::now(); |
| | | int ret = BHRequest(node.data(), node.size(), smsg.data(), smsg.size(), |
| | | // int ret = BHRequest(node.data(), node.size(), smsg.data(), smsg.size(), |
| | | int ret = BHRequest(NULL, 0, smsg.data(), smsg.size(), |
| | | &pid, &pidl, &rep, &repl, 5000); |
| | | // auto e = chrono::steady_clock::now(); |
| | | // printf("request time %lu ms\n", chrono::duration_cast<chrono::milliseconds>(e-s).count()); |
| | |
| | | bhome_msg::MsgRequestTopicReply prep; |
| | | prep.ParseFromArray(rep, repl); |
| | | |
| | | printf("pid %d BHRequest rep data %s size %d ret %d\n", getpid(), prep.data().c_str(), |
| | | repl, ret); |
| | | // printf("pid %d BHRequest rep data %s size %d ret %d\n", getpid(), prep.data().c_str(), |
| | | // repl, ret); |
| | | |
| | | } |
| | | } |