This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/11521] New: Can install server socket on same port twice
- From: "mqm at magma dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jul 2003 02:03:12 -0000
- Subject: [Bug java/11521] New: Can install server socket on same port twice
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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");
}
}