| | |
| | | { |
| | | if (!topic || topic_len <= 0) return false; |
| | | |
| | | return simple_request(get_url(URLQueryTopic), topic, topic_len, reply, reply_len, timeout_ms); |
| | | auto url(get_url(URLQueryTopic)); |
| | | |
| | | if (remote && remote_len > 0){ |
| | | BHAddress addr; |
| | | if (addr.ParseFromArray(remote, remote_len)){ |
| | | if (!addr.ip().empty() && addr.port() > 0){ |
| | | // url = "tcp://" + addr.ip() + ":" + to_string(addr.port()); |
| | | printf("======>> BHQueryTopicAddress use remote address %s\n", url.c_str()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return simple_request(url, topic, topic_len, reply, reply_len, timeout_ms); |
| | | } |
| | | |
| | | // 请求在线进程 request |
| | |
| | | { |
| | | if (!query || query_len <= 0) return false; |
| | | |
| | | auto ret = simple_request(get_url(URLQueryProcs), query, query_len, reply, reply_len, timeout_ms); |
| | | // printf("======>> BHQueryProcs *reply %p reply_len %d\n", *reply, *reply_len); |
| | | return ret; |
| | | auto url(get_url(URLQueryProcs)); |
| | | |
| | | if (remote && remote_len > 0){ |
| | | BHAddress addr; |
| | | if (addr.ParseFromArray(remote, remote_len)){ |
| | | if (!addr.ip().empty() && addr.port() > 0){ |
| | | // url = "tcp://" + addr.ip() + ":" + to_string(addr.port()); |
| | | printf("======>> BHQueryProcs use remote address %s\n", url.c_str()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return simple_request(url, query, query_len, reply, reply_len, timeout_ms); |
| | | } |
| | | |
| | | // above communicate with center |
| | |
| | | |
| | | auto url("ipc:///tmp/" + procid); |
| | | |
| | | BHAddress addr; |
| | | if (addr.ParseFromArray(remote, remote_len)){ |
| | | if (!addr.ip().empty() && addr.port() > 0){ |
| | | url = "tcp://" + addr.ip() + ":" + to_string(addr.port()); |
| | | printf("======>>use remote address %s\n", url.c_str()); |
| | | if (remote && remote_len > 0){ |
| | | BHAddress addr; |
| | | if (addr.ParseFromArray(remote, remote_len)){ |
| | | if (!addr.ip().empty() && addr.port() > 0){ |
| | | url = "tcp://" + addr.ip() + ":" + to_string(addr.port()); |
| | | printf("======>> BHRequest use remote address %s\n", url.c_str()); |
| | | } |
| | | } |
| | | } |
| | | // 使用procid作为ipc通信 |