MulticastSocket's constructor

alice dubois alice.dubois at lemel.fr
Fri Nov 27 02:42:33 PST 1998


Good Morning,

Constructor "public MulticastSocket(int port)" of java/net/
MulticastSocket.java catches a java.lang.NullPointerException in this 
program.
When I run it, the result is:
"try-catch
 java.lang.NullPointerException
	at java.net.MulticastSocket.<init>(27)
	at MulticastPortConstructeur.main(11)"

With the constructor MulticastSocket(), the result is correct.
So, where is the problem ?

Here's the file MulticastPortconstructor.java I use:

import sun.net.*;
import java.net.*;
import java.io.*;

public class MulticastPortConstructor {

  public static void main(String[] args) {
  
    try {
	System.out.println("try-catch");
      MulticastSocket ms = new MulticastSocket(2048);
	System.out.println("middle try-catch");
      System.out.println(ms);
	System.out.println("end try-catch");
    }
    catch (SocketException se) {
	System.out.println("catch 1");
      System.err.println(se);
    }
   catch (IOException ioe) {
	System.out.println("catch 2");
      System.err.println(ioe);
    }
  
  
  }

}

Thanks,

Alice


More information about the kaffe mailing list