This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/11521] New: Can install server socket on same port twice


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11521

           Summary: Can install server socket on same port twice
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mqm at magma dot ca
                CC: gcc-bugs at gcc dot gnu dot org

The following code passes the test in JDK but fails in GCJ. In other words, GCJ 
should throw an exception when one attempts to install a server on a port that 
is being used already.


public class SocketServerBindProblem {

public static void main(String[] args) {
	int port = 40000;
	ServerSocket server1, server2;
	try {
		server1 = new ServerSocket(40000);
	} catch (IOException e) {
		System.out.println("Problem with testcase");
		e.printStackTrace();
	}
	try {
		server2 = new ServerSocket(40000);
		System.out.println("Test failed. It should throw an exception");
	} catch (BindException e) {
		System.out.println("Test succeded. Exception thrown");
	} catch (IOException e) {
		System.out.println("Problem with testcase");
	}
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]