Please see below code just i made a change by placing "throws exception" after 
main method.. 

--- On Mon, 13/7/09, pradeepan patra <[email protected]> wrote:

From: pradeepan patra <[email protected]>
Subject: [java programming] Please help me
To: [email protected]
Date: Monday, 13 July, 2009, 8:28 PM

hiiiiii friends

Can anyone say me what is the error in this code

import java.net.*;
public class MulticastChatServer 
    {
      public static void main(String[] args)  throws Exception  // U need to 
place code here 
        {
             

            {
                 int portnumber = 1236;
                 if (args.length >= 1)
                {
                    portnumber = Integer.parseInt(args[0]);
                }
             MulticastSocket serverMulticastSocket =new 
MulticastSocket(portnumber);

             System.out.println("MulticastSocket is created at port 
"+portnumber);
             InetAddress group=InetAddress.getByName("224.0.0.1");
             serverMulticastSocket.joinGroup(group);

             System.out.println("joinGroup method is called...");
             boolean infinite = true;
             while(infinite) 
                {
                 byte buf[] = new byte[1024];

                 DatagramPacket data =new DatagramPacket(buf, buf.length);
                 serverMulticastSocket.receive(data);
                 String msg =new String(data.getData()).trim();
                 System.out.println("Message received from client = " + msg);

                }
                    serverMulticastSocket.close();
            }
        }
    }








      Love Cricket? Check out live scores, photos, video highlights and more. 
Click here http://cricket.yahoo.com
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to