473,425 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Multicast in java

13
Hello,

I work with Client/Server example as below:

Expand|Select|Wrap|Line Numbers
  1. public class Client {
  2. public static void main(String[] args) throws IOException,
  3. ClassNotFoundException {
  4. InetAddress address = InetAddress.getByName("225.6.7.8");
  5. MulticastSocket socket = new MulticastSocket(56565);
  6. socket.joinGroup(address);
  7. byte[] buffer = new byte[1024];
  8. DatagramPacket datagram =
  9. new DatagramPacket(buffer, buffer.length);
  10. socket.receive(datagram);
  11. System.out.println(">>> " + datagram.getData()[0]);
  12. socket.leaveGroup(address);
  13. }
  14. }
  15.  
Expand|Select|Wrap|Line Numbers
  1. public class Server {
  2. public static void main(String[] args) throws IOException,
  3. ClassNotFoundException {
  4. InetAddress address = InetAddress.getByName("225.6.7.8");
  5. DatagramSocket socket = new DatagramSocket();
  6. byte[] buffer = new byte[1024];
  7. buffer[0] = 123;
  8. DatagramPacket datagram =
  9. new DatagramPacket(buffer, buffer.length, address, 56565);
  10. socket.send(datagram);
  11. System.out.println("<<< " + datagram.getData()[0]);
  12. }
  13. }
  14.  
Is it possible to run those on computers belonging to simple lan?. For instance:
10.10.5.2
10.10.5.9

Possibly I did not understand multicast correctly - (should be just logical network over normal physical IP of B,C class)?
Jun 23 '10 #1
1 2731
pb2000
13
Solved. Sorry for stupid question. I am newbie at networking.
Jun 23 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: PHLICS_Admin | last post by:
Hi All, There are two network cards in one computer (named A) , and there is one network card in another computer(named B). On computer A: one network card is used to connect to internet, and...
7
by: Jim H | last post by:
Is there something special I need to do to send data to a multicast IP and have it go across a router? Router is a Win2000 Server connecting 2 networks via RRAS PPTP. The routing appears to be...
2
by: Terry | last post by:
I've got a strange problem receiving multicast packets in a C# application. What's strange is that it works *sometimes* but not always. I create a socket, call bind(), set the multicast socket...
5
by: - | last post by:
Hi to All, Is there any trick for adding additional runtime info (for example a string) to a delegate instance? I would like to mimic the Java EventListener - EventListenerProxy,...
7
by: pietro.cerutti | last post by:
Hi guys, I have a daemon running on Debian and listening for multicast packets sent to 224.0.0.251:5353 (ZeroConf Multicast DNS queries). The server is plugged into a VLAN trunk with eth0 and...
1
by: Jayme.Pechan | last post by:
I was working on a multicast client and ran into a possible problem. Here is the code... udpClient = new UdpClient(4000); udpClient.JoinMulticastGroup(IPAddress.Parse("224.1.1.1"));...
1
by: libra | last post by:
There is an algorithm how to use 23 last bits of multicast IP address into mac address by adding 01-00-5e- to convert it into MAC address. I know how to do it in C, but need it in java. The C...
5
by: AliRezaGoogle | last post by:
Hi, I have a conceptual question on Events and Multicast Delegates. Let me explain: As we know an event is a multicast delegate. What we declare as an event is inherently a multicast delegate....
0
by: Stodge | last post by:
I'm trying to get a simple multicast application working using Twisted; so far I have: from twisted.internet.protocol import DatagramProtocol from twisted.internet import reactor from...
0
by: Hotice | last post by:
Hello all, I want to create a web application for sending booking requests to DHL. I already found a toolkit (http://xmlshippingtest.dhl-usa.com/toolkit/index.html) that uses XML files to send the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.