[aravis] gv_interface: use 255.255.255.255 as broadcast address for device discovery.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] gv_interface: use 255.255.255.255 as broadcast address for device discovery.
- Date: Mon, 21 Oct 2013 08:31:33 +0000 (UTC)
commit bf50185c01a823610507afce2cfcc9f54565da20
Author: Csaba Toth <csaba toth aptomar com>
Date: Mon Oct 21 10:29:14 2013 +0200
gv_interface: use 255.255.255.255 as broadcast address for device discovery.
Some cameras don't respond to discovery packets if the destination is not
255.255.255.255.
src/arvgvinterface.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/src/arvgvinterface.c b/src/arvgvinterface.c
index 4fe8d61..e5dddc9 100644
--- a/src/arvgvinterface.c
+++ b/src/arvgvinterface.c
@@ -44,7 +44,6 @@
typedef struct {
GSocketAddress *interface_address;
- GSocketAddress *broadcast_address;
GSocket *socket;
} ArvGvDiscoverSocket;
@@ -100,15 +99,6 @@ arv_gv_discover_socket_list_new (void)
discover_socket->interface_address = g_inet_socket_address_new (inet_address, 0);
g_object_unref (socket_address);
- socket_address = g_socket_address_new_from_native (ifap_iter->ifa_broadaddr,
- sizeof (struct sockaddr));
- inet_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS
(socket_address));
- discover_socket->broadcast_address = g_inet_socket_address_new (inet_address,
ARV_GVCP_PORT);
- inet_address_string = g_inet_address_to_string (inet_address);
- arv_debug_interface ("[GvDiscoverSocket::new] Broadcast address is %s",
inet_address_string);
- g_free (inet_address_string);
- g_object_unref (socket_address);
-
discover_socket->socket = g_socket_new (G_SOCKET_FAMILY_IPV4,
G_SOCKET_TYPE_DATAGRAM,
G_SOCKET_PROTOCOL_UDP, NULL);
@@ -144,7 +134,6 @@ arv_gv_discover_socket_list_free (ArvGvDiscoverSocketList *socket_list)
ArvGvDiscoverSocket *discover_socket = iter->data;
g_object_unref (discover_socket->interface_address);
- g_object_unref (discover_socket->broadcast_address);
g_object_unref (discover_socket->socket);
g_free (discover_socket);
}
@@ -161,19 +150,25 @@ arv_gv_discover_socket_list_free (ArvGvDiscoverSocketList *socket_list)
static void
arv_gv_discover_socket_list_send_discover_packet (ArvGvDiscoverSocketList *socket_list)
{
+ GInetAddress *broadcast_address;
+ GSocketAddress *broadcast_socket_address;
ArvGvcpPacket *packet;
GSList *iter;
size_t size;
packet = arv_gvcp_packet_new_discovery_cmd (&size);
+ broadcast_address = g_inet_address_new_from_string ("255.255.255.255");
+ broadcast_socket_address = g_inet_socket_address_new (broadcast_address, ARV_GVCP_PORT);
+ g_object_unref (broadcast_address);
+
for (iter = socket_list->sockets; iter != NULL; iter = iter->next) {
ArvGvDiscoverSocket *discover_socket = iter->data;
GError *error = NULL;
arv_gv_discover_socket_set_broadcast (discover_socket, TRUE);
g_socket_send_to (discover_socket->socket,
- discover_socket->broadcast_address,
+ broadcast_socket_address,
(const char *) packet, size,
NULL, &error);
if (error != NULL) {
@@ -183,6 +178,8 @@ arv_gv_discover_socket_list_send_discover_packet (ArvGvDiscoverSocketList *socke
arv_gv_discover_socket_set_broadcast (discover_socket, FALSE);
}
+ g_object_unref (broadcast_socket_address);
+
arv_gvcp_packet_free (packet);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]