Linux 7.1 errors with Socket(InetAddress a, int p, InetAddress l, int lport)
The above constructor does not work on Linux 7.1 (kernel 2.4.1). It will never
select a local port in a test loop attempting to create a connection starting
on local port 500 to infinity.
For invalid ports 550 to 1023 it correctly throws a BindException.
For valid ports above 1024, Linux 7.1 throws
Socket Exception errno 22, error Invalid Argument for fd: 5.
never selects a port, and the test keeps executing.
Linux 6.2 executes correctly throwing the bind exception for ports
under 1023, then stops at port 1024 and exits the test.
excerpt from Test:
try {
System.out.println("testcase#3");
InetAddress remote = InetAddress.getByName
("shorter.eng.sun.com");
int remoteport = 13;
InetAddress local = InetAddress.getLocalHost();
int localport=550;
Socket mysocket=null;
for (;;){
localport++;
try {
mysocket = new Socket(remote, remoteport, local, localport);
} catch ( Exception x) {
System.out.println("localport = " + localport + x);
continue;
}
break;
}
System.out.println("Localport = " +localport);
[end]
Full test file attached.
The above constructor does not work on Linux 7.1 (kernel 2.4.1). It will never
select a local port in a test loop attempting to create a connection starting
on local port 500 to infinity.
For invalid ports 550 to 1023 it correctly throws a BindException.
For valid ports above 1024, Linux 7.1 throws
Socket Exception errno 22, error Invalid Argument for fd: 5.
never selects a port, and the test keeps executing.
Linux 6.2 executes correctly throwing the bind exception for ports
under 1023, then stops at port 1024 and exits the test.
excerpt from Test:
try {
System.out.println("testcase#3");
InetAddress remote = InetAddress.getByName
("shorter.eng.sun.com");
int remoteport = 13;
InetAddress local = InetAddress.getLocalHost();
int localport=550;
Socket mysocket=null;
for (;;){
localport++;
try {
mysocket = new Socket(remote, remoteport, local, localport);
} catch ( Exception x) {
System.out.println("localport = " + localport + x);
continue;
}
break;
}
System.out.println("Localport = " +localport);
[end]
Full test file attached.