multicast

Does Java NIO support broadcast or multicast?

两盒软妹~` 提交于 2019-12-06 00:40:44
I am searching if Java NIO implements broadcast. I need to create a peer that sends messages to other peers, using multicast or broadcast. I was searching in the API 1.6, but I don't find anything in the DatagramChannel class. Thanks in advance. NIO2 supports multicast, that's in Java 7. http://javanio.info/filearea/nioserver/WhatsNewNIO2.pdf Before NIO2 you have to make use of all kinds of hacks to make a datagram channel join a multicast group. Not sure how they could have left multicast channels out of NIO1. You don't need to use NIO for this, java.net.MulticastSocket supports this directly

Best tutorial for application multicasting? [closed]

别说谁变了你拦得住时间么 提交于 2019-12-06 00:12:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I've recently become aware that there's a distinction between IP multicasting (which apparently doesn't work that well on the public internet) and application multicasting (which is apparently used in IRC and PSYC, per http://en.wikipedia.org/wiki/Multicast). Is there a good tutorial on implementing application

How do I implement a multicast client in NIO.2?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 19:19:13
How would an example of using a Java 7 NIO.2 multicast client look like? I could only find half of an example in the MulticastChannel documentation. This example works. Note that DatagramChannel.join() requires a NetworkInterface to work. NetworkInterface ni = NetworkInterface.getByInetAddress(address); InetAddress group = InetAddress.getByName("239.255.0.1") DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET) .setOption(StandardSocketOptions.SO_REUSEADDR, true) .bind(new InetSocketAddress(5000)) .setOption(StandardSocketOptions.IP_MULTICAST_IF, ni); MembershipKey key = dc

Receiving multicast data from different groups on the same socket in linux

99封情书 提交于 2019-12-05 18:44:10
Say I want to receive data from 239.1.2.3:20000 and also from 239.4.5.6:20001 in a linux C program. Can I do so with just one socket? I can of course join multiple groups on the socket using the IP_ADD_MEMBERSHIP setsockopt option, but, since the ports are different, I am not sure if it is possible to somehow "bind to both ports" user207421 No, you can't bind a socket to 2 ports, you need a socket per port. In TCP, there needs to be one socket per client. This is because the socket needs to have a connection "accepted." This is done by calling accept on the server's listening socket, and it

C# SocketException with Multicast on XP

六眼飞鱼酱① 提交于 2019-12-05 10:57:12
The following C# code works correctly on Vista, but fails on XP with: SocketException: An invalid argument was supplied. The ErrorCode is 10022. The firewall on XP has been disabled. using System; using System.Net; using System.Net.Sockets; public class SocketTest { [STAThread] public static void Main() { MySocket s = new MySocket(); Console.WriteLine("done"); Console.ReadLine(); } public class MySocket : Socket { public const ushort SocketTtl = 4; public const string Address = "239.255.255.250"; public IPAddress IPAddress = IPAddress.Parse(Address); public MySocket() : base(AddressFamily

UDPClient Multicast receive fails on computer with multiple NICs

蹲街弑〆低调 提交于 2019-12-05 10:51:37
I've got a computer with multiple NICs - and UDPClient's send method continually fails. Here's the code: private static void receiveData() { recvSock = new UdpClient(PORT); //recvSock.Client.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, mainInterface); recvSock.JoinMulticastGroup(IPAddress.Parse(IP), 50); IPEndPoint iep = new IPEndPoint(IPAddress.Any, 0); while (true) { byte[] data = recvSock.Receive(ref iep); // Do not include messages from us if (myIPs.Contains(iep.Address)) continue; string stringData = Encoding.ASCII.GetString(data, 0, data.Length); Console

Upper limit to UDP performance on windows server 2008

纵然是瞬间 提交于 2019-12-05 07:14:58
问题 It looks like from my testing I am hitting a performance wall on my 10gb network. I seem to be unable to read more than 180-200k packets per second. Looking at perfmon, or task manager I can receive up to a million packets / second if not more. Testing 1 socket or 10 or 100, doesn't seem to change this limit of 200-300k packets a second. I've fiddled with RSS and the like without success. Unicast vs multicast doesn't seem to matter, overlapped i/o vs synchronous doesn't make a difference

Why are my UDP multicast not reaching machines on the network?

痞子三分冷 提交于 2019-12-05 07:05:58
问题 I am trying to set up auto discovery using UDP multicasting, and am using some sample code from the internet. this seems to work ok when I run the client and the server on the same machine, but when I run them on different machines, either with a machine running in a VM on my machine (virtualBox) or on other 'real' machines on the network then the other machines never seem to receive the messages being broadcast. After some googling it seems the likely culprit would be the router (SpeedTouch

Multicast support in .Net

北城余情 提交于 2019-12-05 05:51:55
In order to implement a network application that uses multicasts to send small periodic messages to other processes in the network, what choices do I have with regard to using APIs in the .Net framework? Apart from my obvious current choice, the System.net.sockets API, does WCF provide a simpler approach? Or is WCF purely a point-to-point SOA-based IPC mechanism? Note : I'm quite conversant with the implementation details of multicast programming. What I am interested in hearing is what other choices the .Net framework offers. I was going to suggest that use callback channels (i.e. a pub/sub

listing multicast sockets

∥☆過路亽.° 提交于 2019-12-05 03:47:33
I am trying to list all opened multicast sockets on a linux system? netstat -g lists the groups joined though. Is there any other utility that I can use for this sake? Thanks a lot for the help. In addition to netstat -g you can use this to see all sockets which are bound to a multicast address: netstat -anu|sort -nk4 This is a list of all UDP sockets (whether multicast or not). Look for all addresses in the range 224.0.0.0 to 239.255.255.255. These are sockets bound to multicast addresses, regardless whether they joined the multicast group or not. These will only receive traffic for this