UdpSrc?
killerrats
koreysjunkmail at gmail.com
Tue Oct 15 21:33:33 UTC 2019
Got it to work. the ones in bold and big are the ones I edited in the code.
GSocket* GetTheSocketReady(const char* ipaddress, const int portNumber,
const char* interfaceIp){ GSocketAddress *bind_addr; GInetAddress
*bind_iaddr; GSocketFamily family; guint16 port = portNumber; GError *err =
NULL; gint val = 0; const guint8 *native_addr; *struct ip_mreq mc_req;*
GInetSocketAddress *bAddr; guint16 bPort; bind_iaddr =
g_inet_address_new_from_string(ipaddress); bind_addr =
g_inet_socket_address_new(bind_iaddr, port); family =
g_socket_address_get_family(G_SOCKET_ADDRESS(bind_addr)); GSocket *
socketUDP = g_socket_new(family, G_SOCKET_TYPE_DATAGRAM,
G_SOCKET_PROTOCOL_UDP, &err); if (socketUDP == NULL) { printf("Could not
create socket: %s", err->message); g_object_unref(bind_addr); goto Error;
} if (!g_socket_bind(socketUDP,
g_inet_socket_address_new(g_inet_address_new_from_string(interfaceIp),
port), TRUE, &err)) { printf("Failed to bind socket: %s", err->message);
goto Error; } g_socket_set_multicast_loopback(socketUDP, TRUE); if
(g_socket_get_option(socketUDP, SOL_SOCKET, SO_RCVBUF, &val, NULL)) {
std::cout << "\r\nReceived\r\n"; } else { goto Error; }
g_socket_set_broadcast(socketUDP, TRUE); native_addr =
g_inet_address_to_bytes(bind_iaddr); memset(&mc_req, 0, sizeof(mc_req));
memcpy(&mc_req.imr_multiaddr, native_addr, sizeof(struct in_addr));
*inet_pton(AF_INET, interfaceIp, &mc_req.imr_interface);*
*inet_pton(AF_INET, ipaddress, &mc_req.imr_multiaddr);* if
(setsockopt(g_socket_get_fd(socketUDP), IPPROTO_IP, IP_ADD_MEMBERSHIP,
(char*)&mc_req, sizeof(mc_req))) { printf("\r\nYeah\r\n"); }End: {
g_object_unref(bind_iaddr); return socketUDP; }Error: {
g_object_unref(bind_iaddr); return NULL; }}
-----
------------------------------
Gstreamer 1.14.3
------------------------------
Windows
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20191015/41118c9d/attachment-0001.html>
More information about the gstreamer-devel
mailing list