| | |
| | | if (ret == true) { |
| | | printf("the process registered OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process registered fail with error: %s\n", (char *)errBuf); |
| | |
| | | printf("the second way to get the error log: %s\n", buf_temp); |
| | | |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | ret = BHUnregister(NULL, 0, &buf_temp, &size, timeout_ms); |
| | | if (ret == true) { |
| | | printf("the process unregistered OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process unregistered fail with error: %s\n", (char *)errBuf); |
| | |
| | | printf("the second way to get the error log: %s\n", buf_temp); |
| | | |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | } |
| | | |
| | | //const char *topics_reg_buf1[] = {"topics demo1"}; |
| | |
| | | if (ret == true) { |
| | | printf("the process registered OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process registered fail with error: %s(%s)\n", (char *)errBuf, buf_temp); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | ret = BHRegisterTopics(topics_reg_buf1, strlen(topics_reg_buf1), &buf_temp, &size, timeout_ms); |
| | | if (ret == true) { |
| | | printf("the process registered topics OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process registered1 fail with errorL %s(%s)\n", (char *)errBuf, buf_temp); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | ret = BHRegisterTopics(topics_reg_buf2, strlen(topics_reg_buf2), &buf_temp, &size, timeout_ms); |
| | | if (ret == true) { |
| | | printf("the process registered topics OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process registered2 fail with error: %s(%s)\n", (char *)errBuf, buf_temp); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | ret = BHQueryTopicAddress(NULL, 0, topics_query_buf1, strlen(topics_query_buf1), &buf_temp, &size, timeout_ms); |
| | | if (ret == true) { |
| | |
| | | |
| | | parseQueryTopicsBuf(buf_temp, size); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process query3 fail with error: %s(%s)\n", (char *)errBuf, buf_temp); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | ret = BHQueryTopicAddress(NULL, 0, topics_query_buf2, strlen(topics_query_buf2), &buf_temp, &size, timeout_ms); |
| | | if (ret == true) { |
| | |
| | | |
| | | parseQueryTopicsBuf(buf_temp, size); |
| | | |
| | | BHFree(buf_temp, size); |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process query4 fail with error: %s(%s)\n", (char *)errBuf, buf_temp); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | pthread_create(&tids, NULL, client_recv, NULL); |
| | | |
| | |
| | | if (ret == true) { |
| | | printf("the process registered topics OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process registered1 fail with errorL %s(%s)\n", (char *)errBuf, buf_temp); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | ret = BHSubscribeTopics(topics_sub_buf1, strlen(topics_sub_buf1), &buf_temp, &size, timeout_ms); |
| | | if (ret == true) { |
| | | printf("the process subscribe topics OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process sub1 fail with error: %s(%s)\n", (char *)errBuf, buf_temp); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | ret = BHSubscribeTopics(topics_sub_buf2, strlen(topics_sub_buf2), &buf_temp, &size, timeout_ms); |
| | | if (ret == true) { |
| | | printf("tthe process subscribe topics OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process sub2 fail with error: %s\n", (char *)errBuf); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | ret = BHRegisterTopics(topics_reg_buf2, strlen(topics_reg_buf2), &buf_temp, &size, timeout_ms); |
| | | if (ret == true) { |
| | | printf("the process registered topics OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process registered10 fail with errorL %s\n", (char *)errBuf); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | const char *topics_server_specific_reg_buf1 = "Server Specific topics demo1"; |
| | | const char *topics_server_specific_reg_buf2 = "Server Specific Hello World"; |
| | |
| | | |
| | | printf("the response data(%s) from procid(%s)\n", data_buf, (char *)proc_id); |
| | | |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process BHRequest topics fail with error: %s\n", (char *)errBuf); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | } |
| | | |
| | | ret = BHRequest(NULL, 0, topics_server_specific_reg_buf2, strlen(topics_server_specific_reg_buf2), &proc_id, &id_len, |
| | | &buf_temp, &size, timeout_ms); |
| | |
| | | |
| | | printf("the response data(%s) from procid(%s)\n", data_buf, (char *)proc_id); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | |
| | | BHGetLastError(&errBuf, &size); |
| | |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | #if !defined(PRO_DE_SERIALIZE) |
| | | ret = BHPublish(topics_pub_topic1, topics_pub_topic1_data, timeout_ms); |
| | |
| | | |
| | | parseQueryProcBuf(buf_temp, size); |
| | | |
| | | BHFree(buf_temp, size); |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process query proc fail with error: %s\n", (char *)errBuf); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | #if 1 |
| | | while(1) { |
| | |
| | | if (ret == true) { |
| | | printf("the process unregistered OKay\n"); |
| | | |
| | | BHFree(buf_temp, size); |
| | | |
| | | } else { |
| | | BHGetLastError(&errBuf, &size); |
| | | printf("the process unregistered fail with error: %s\n", (char *)errBuf); |
| | | |
| | | BHFree(errBuf, size); |
| | | }; |
| | | BHFree(buf_temp, size); |
| | | |
| | | #endif |
| | | |