Subject: Re: JDK1.1.1 (L*NUX port), was Re: applix
To: Hauke Fath <hf@melog.de>
From: Nathaniel D. Daw <daw@panix.com>
List: port-i386
Date: 06/27/1997 11:14:58
> I am currently trying to run the Linux port of the Sun JDK 1.1.1 on stock
> NetBSD 1.2.1. I am playing around with a CORBA-compliant Java ORB
> (<http://www.inf.fu-berlin.de/~brose/jacorb>); an example compiles fine but
> dies with a socket-related error:
> "java.net.SocketException: Transport endpoint is already connected
> 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:290)"

I actually ran into this problem some time ago with an older Linux JDK,
and managed to avoid it with a one-line hack to the kernel, though I was
never sure I had done the right thing. I'm a little fuzzy on the details
at this point.

It had something to do with attempting a nonblocking connect(), which
either works differently under Linux  or is improperly implemented in the
JDK. From a ktrace, I think I found the JDK connect()s to the socket,
select()s for completion, and then, when the select returns that the
connection is complete, calls connect() a second time, getting the EISCONN
which crashes it. I don't know why it does this; my guess (which I have
never been able to verify) is that the nonblocking connect process is
actually different under Linux, and involves a second call to connect() to
finish the job.

It's ugly, but you can patch the linux connect() wrapper code to silently
return, supressing the EISCONN, and it works fine. With no access to the
jdk source, nor to a real linux system, I was never able to confirm
exactly what was wrong.

nd