multicast

Error “No such device” in call setsockopt when joining multicast group

喜欢而已 提交于 2019-11-29 17:55:24
问题 I have a code in which send multicast datagrams. A critical piece of code: uint32_t port; int sockfd, err_ip; const uint32_t sizebuff = 65535 - (20 + 8); unsigned char *buff = (unsigned char *) malloc(sizebuff); struct sockaddr_in servaddr, cliaddr; struct in_addr serv_in_addr; struct ip_mreq req; port = str2uint16(cmdsrv->ipport); bzero(buff, (size_t)sizebuff); bzero(&servaddr, sizeof(servaddr)); bzero(&serv_in_addr, sizeof(serv_in_addr)); err_ip = inet_aton(cmdsrv->ipaddr, &serv_in_addr);

Why does multicast reception not work on some Android devices?

人走茶凉 提交于 2019-11-29 14:00:10
问题 It seems multicast reception does not work on some Android devices. I can not receive multicast with 4 out of 13 test devices. On those 4 devices it seems the app does not send the IGMP request to join the multicast group. The code to receive the multicast looks like so: WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE); WifiManager.WifiLock wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, TAG); WifiManager.MulticastLock

Network discovery in Java Multicast/Broadcast Java

流过昼夜 提交于 2019-11-29 08:58:16
Here's what I'm trying to do- A server sends out "Alive message to all the PCs on the network and the PCs which are up and running, respond to the call by sending their IP. I'm looking at a lightweight piece of coding as this will form a small bit of my application. I've looked at Jini and other services but find that I may not need even half of their features(except for the network discovery) Is it ok if I: 1. Use a for loop where a server opens a socket, checks(using a for loop) if all the IPs x.x.x.x are reachable by sending an "Alive" message. 2. On receiving the "alive" message at the

How to limit traffic using multicast over localhost

拟墨画扇 提交于 2019-11-29 06:58:44
I'm using multicast UDP over localhost to implement a loose collection of cooperative programs running on a single machine. The following code works well on Mac OSX, Windows and linux. The flaw is that the code will receive UDP packets outside of the localhost network as well. For example, sendSock.sendto(pkt, ('192.168.0.25', 1600)) is received by my test machine when sent from another box on my network. import platform, time, socket, select addr = ("239.255.2.9", 1600) sendSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) sendSock.setsockopt(socket.IPPROTO_IP,

How do I determine the source IP of a multicast packet in C#?

為{幸葍}努か 提交于 2019-11-29 06:57:12
I need to determine the IP of a machine that has sent me a multicast packet, so that I can respond to it via unicast. I'm using the following csharp (.Net 3.5) code to receive the packets over a multicast connection (code has been edited for brevity, with error checking and irrelevant options removed): IPEndPoint LocalHostIPEnd = new IPEndPoint(IPAddress.Any, 8623); Socket UDPSocket = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp); UDPSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastLoopback, 1); UDPSocket.Bind(LocalHostIPEnd); //Join the

How to set up a socket for UDP multicast with 2 network cards present?

限于喜欢 提交于 2019-11-29 02:50:17
问题 I'm trying to get udp multicast data using sockets and c++ (c). I have a server with 2 network cards so I need to bind socket to specific interface. Currently I'm testing on another server that has only one network card. When I use INADDR_ANY I can see the udp data, when I bind to specific interface I don't see any data. Function inet_addr is not failing (I removed checking for return value for now). Code is below. On a server with one network card, my IP address is 10.81.128.44. I receive

Python Netlink Multicast Communication in Kernels above 4

天涯浪子 提交于 2019-11-29 02:45:40
I was trying to reproduce the example from a previous SO post on a kernel above 4 (4.1): #include <linux/module.h> #include <linux/kernel.h> #include <linux/netlink.h> #include <net/netlink.h> #include <net/net_namespace.h> /* Protocol family, consistent in both kernel prog and user prog. */ #define MYPROTO NETLINK_USERSOCK /* Multicast group, consistent in both kernel prog and user prog. */ #define MYGRP 31 static struct sock *nl_sk = NULL; static void send_to_user(void) { struct sk_buff *skb; struct nlmsghdr *nlh; char *msg = "Hello from kernel"; int msg_size = strlen(msg) + 1; int res; pr

Specifying what network interface an UDP multicast should go to in .NET

。_饼干妹妹 提交于 2019-11-29 01:26:26
问题 On a computer with both an active Wireless Card and a LAN-Port with a crossover cable hooked up to another machine running the same application, we need to send a UDP multicast over the LAN wire to the other computer. Using C# Sockets, Windows seems to try to route the message over the WLAN adapter every time. Is there a way to specify what network interface to send a UDP multicast on? 回答1: You are probably looking for SocketOptionName.MulticastInterface . Here's an article on MSDN that might

Need microsecond delay in .NET app for throttling UDP multicast transmission rate

被刻印的时光 ゝ 提交于 2019-11-29 00:10:10
I'm writing a UDP multicast client/server pair in C# and I need a delay on the order of 50-100 µsec (microseconds) to throttle the server transmission rate. This helps to avoid significant packet loss and also helps to keep from overloading the clients that are disk I/O bound. Please do not suggest Thread.Sleep or Thread.SpinWait. I would not ask if I needed either of those. My first thought was to use some kind of a high-performance counter and do a simple while() loop checking the elapsed time but I'd like to avoid that as it feels kludgey. Wouldn't that also peg the CPU utilization for the

Send Broadcast datagram

二次信任 提交于 2019-11-28 20:34:59
问题 I need to send a broadcast datagram to all machine (servers) connected to my network. I'm using NodeJS Multicast Client var dgram = require('dgram'); var message = new Buffer("Some bytes"); var client = dgram.createSocket("udp4"); client.send(message, 0, message.length, 41234, "localhost"); // If I'm in the same machine 'localhost' works // I need to do something 192.168.0.255 or 255.255.255 client.close(); Servers var dgram = require("dgram"); var server = dgram.createSocket("udp4"); server