A multicast socket is a bi-directional communications endpoint used for the sending of packets to multiple receivers via multicast (typically IP) or for receiving multicast packets.
Questions tagged [multicastsocket]
156 questions
45
votes
5 answers
Getting `Can't assign requested address` java.net.SocketException using Ehcache multicast
Getting java.net.SocketException when trying to start a multicast provider:
2013-09-11 11:45:44,204 [main] ERROR net.sf.ehcache.distribution.MulticastRMICacheManagerPeerProvider: Error starting heartbeat. Error was: Can't assign requested…

eebbesen
- 5,070
- 8
- 48
- 70
10
votes
2 answers
MulticastSocket constructors and binding to port or SocketAddress
I may have a fundamental misunderstanding of the term binding here but I am confused about the usage of the MulticastSocket and it's constructors. They no not do what I understand they should do should do so any who can help me clear my…

D-Dᴙum
- 7,689
- 8
- 58
- 97
8
votes
2 answers
Problem with MulticastSocket on Java-Android
I'm starting to code with MulticastSocket, trying to make a simple app with a client and a server to send messages.
The code I have for the server:
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
…

Diego Ulloa
- 111
- 1
- 3
- 5
8
votes
1 answer
java.net.SocketException: Not a multicast address
I was working with a MulticastSocket and when ever I tried to join a group, it would never work when I was running the group on the "localhost" ip. However, I found this article http://lycog.com/programming/multicast-programming-java/ that stated…

swrap
- 314
- 1
- 3
- 11
8
votes
2 answers
Multicast packets: sending and receiving issues
In my adaption of a few multicast tutorials, I changed my method of sending packets.
In my case, I create a queue of packets of size bytes[1024], after which it is sent via Socket.Send() over all online network adapters
Problem:
When sending,…
user2699451
6
votes
2 answers
Is Java MulticastSocket threadsafe?
I have two threads.
First one sends datagrams with a MulticastSocket in loop; the second thread receives datagrams using the same instance of MulticastSocket in loop.
It seems to be working properly, but I'm still in doubts.
Can these two threads…

Lopotun
- 611
- 7
- 15
5
votes
5 answers
How to minimize UDP packet loss
I am receiving ~3000 UDP packets per second, each of them having a size of ~200bytes. I wrote a java application which listens to those UDP packets and just writes the data to a file. Then the server sends 15000 messages with previously specified…

nath
- 2,848
- 12
- 45
- 75
5
votes
0 answers
Occasional java.io.IOException: Operation not permitted only on Android 7.0 by DatagramSocket.send()
The following code works fine virtually 100% time on all Android device Android 7.0:
DatagramSocket clientSocket = new DatagramSocket();
clientSocket.setSoTimeout(4000);
clientSocket.setReuseAddress(true); …

Hong
- 17,643
- 21
- 81
- 142
5
votes
1 answer
receive multicast from specific network interface on Linux
I'm trying to receive a multicast data from specific network interface on CentOS 5.5
sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(1234);
addr.sin_addr.s_addr =…

Dima
- 1,253
- 3
- 21
- 31
5
votes
1 answer
ssdp discovery of upnp devices using multicast sockets
i am trying to discover UPnP devices in the network using multicast sockets however, I seem to be getting the same device multiple times. What is the issue with the discovery code here.
The results I am getting are as follows
HTTP/1.1 200…

TrustyCoder
- 4,749
- 10
- 66
- 119
5
votes
1 answer
Openwrt allow multicast traffic
I'm running openwrt on a device and have a python script that listens and prints to screen multicast traffic on 239.2.1.1.
However nothing is being printed to the screen and I believe this is a firewall issue.
How do I make sure that multicast…

Steven Lutz
- 467
- 1
- 6
- 16
5
votes
1 answer
UDP with mulicast sockets over wireless network
I wrote a simple udp server client application with multicast sockets. Server is sending packets to three clients every 6 ms . Packet
size is 1200 bytes. This is 166,66 packets per second. Whenever one of the client detects a missing packet, it will…

user3852803
- 154
- 1
- 2
- 11
4
votes
1 answer
Why is MulticastSocket.setNetworkInterface() much slower using Java 8 runtime?
I am running the following program, which is much slower when I use a Java 8 runtime compared to a Java 7 runtime.
public class MulticastTest {
public static void main(String args[]) throws Exception {
long start = System.nanoTime();
…

K Erlandsson
- 13,408
- 6
- 51
- 67
3
votes
1 answer
Send and receive UDP multicast packets with the same socket
I could not find a working example for this, so I am going to post a question (and let's see if I can reduce this to an MVP code example). So, I need to do mdns queries, I can use two sockets (one for sending / second for receiving) but so far I…

Rudolfs Bundulis
- 11,636
- 6
- 33
- 71
3
votes
2 answers
MulticastSocket not responding after failure
I get a SocketException when trying to call joinGroup(addr) on MulticastSocket. This is only happening on a Windows machine that we have setup to auto start our appliction when the machine is booted up.
It seems like the exception is thrown because…

Tony Eichelberger
- 7,044
- 7
- 37
- 46