Two Laptop Bag*
The moose likes Beginning Java and the fly likes Urgently Help/Guidance Required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Urgently Help/Guidance Required" Watch "Urgently Help/Guidance Required" New topic

Urgently Help/Guidance Required

Vrishal Likhite

Joined: Nov 21, 2005
Posts: 18
The programme is in Rmi, i want an ordered list of hostnames in a multicast group.The PROBLEM is that i want to receive the server name on client and send client name to the server

i am sendin my rmi implimentation file please take a look....

public void send() throws RemoteException

//used to get the computer name


InetAddress address;
String name=address.getHostName();

//Building socket to send the name

MulticastSocket socket=new MulticastSocket(6000);
DatagramPacket packet;
byte buffer[] = new byte[256];
packet= new DatagramPacket(buffer, buffer.length,address, 9013);
System.out.println("Name Sent");


catch(Exception e)
System.out.println("error in data send");


public void receive()throws RemoteException
InetAddress address= InetAddress.getByName("");
MulticastSocket socket;
DatagramPacket packet;
byte buffer[] = new byte[256];
System.out.println("in receive");

//Receive the names of others

String data="No data";
socket= new MulticastSocket(9013);
packet =new DatagramPacket(buffer, buffer.length);
System.out.println("group joined");
data=new String(packet.getData());
System.out.println("The Recieved Data =="+data);
catch(Exception e)
System.out.println("error in data receive");


Am stuck up in this part of code above and urgent answer is expected.

thanking you in advance

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Urgently Help/Guidance Required
Similar Threads
Network assignment HELP NEEDED
Writing a class that receive and broadcast at the same time
multicast problems
Multicast Problem
multicast socket problem