int comp_group_send_data(gchar *uuid_dev, gchar *addr, int port, gchar *data, int len)
{
int ret;
+ char ip[50];
+ char *percent;
LOG_BEGIN();
+ g_strlcpy(ip, addr, strlen(addr) + 1);
+
+ /* Remove % from address */
+ percent = strchr(ip, '%');
+ if (percent)
+ percent[0] = '\0';
+
iot_discovery_t *iot = g_new0(iot_discovery_t, 1);
iot->uuid = g_strdup(uuid_dev);
- iot->host = g_strdup_printf("coap://[%s]:%d", addr, port);
+
+ if (strchr(ip, ':'))
+ iot->host = g_strdup_printf("coap://[%s]:%d", ip, port);
+ else
+ iot->host = g_strdup_printf("coap://%s:%d", ip, port);
+
iot->data = g_malloc0(len);
if (NULL == iot->data) {
ret = COMP_ERROR_OUT_OF_MEMORY;