printf("Service Type : %s\n", type);
rv = dnssd_service_get_ip(service, &ip_v4_address, &ip_v6_address);
- if (rv == DNSSD_ERROR_NONE) {
+ if (rv == DNSSD_ERROR_NONE) {
if (ip_v4_address)
printf("IPv4 Address : %s\n", ip_v4_address);
if (ip_v6_address)
}
rv = dnssd_service_get_port(service, &port);
- printf("Port : %d\n", port);
+ if (rv == DNSSD_ERROR_NONE)
+ printf("Port : %d\n", port);
printf("TXT Record : ");
- dnssd_service_get_all_txt_record(service, &txt_len,
+ rv = dnssd_service_get_all_txt_record(service, &txt_len,
(void *)&txt_record);
- show_txt_record(txt_len, txt_record);
- printf("\n");
+ if (rv == DNSSD_ERROR_NONE) {
+ show_txt_record(txt_len, txt_record);
+ printf("\n");
+ }
g_free(ip_v4_address);
g_free(ip_v6_address);
printf("Successfully added record\n");
+ g_free(data);
return 1;
}
}
rv = dnssd_service_get_port(remote_service, &port);
- printf("Port : %d\n", port);
+ if (rv == DNSSD_ERROR_NONE)
+ printf("Port : %d\n", port);
printf("TXT Record : ");
dnssd_service_get_all_txt_record(remote_service, &txt_len,
(void *)&txt_record);
- show_txt_record(txt_len, txt_record);
+ if (rv == DNSSD_ERROR_NONE)
+ show_txt_record(txt_len, txt_record);
g_free(ip_v4_address);
g_free(ip_v6_address);