harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Gustavsson <nik...@protocol7.com>
Subject Re: Problems with NIO
Date Wed, 25 Feb 2009 22:09:49 GMT
On Wed, Feb 25, 2009 at 8:54 PM, Niklas Gustavsson <niklas@protocol7.com> wrote:
> java.net.SocketException: No such file or directory
>        at org.apache.harmony.luni.platform.OSNetworkSystem.read(OSNetworkSystem.java)
>        at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:557)
>        at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:87)

Some further details on this problem. First of all, it only seems to
happen for a client that is connected against certain (NIO?) servers.
Running against netcat for example does not expose the bug. Also, it
only happens when the socket timeout is set on the client. Thus,
having MINA, SLF4j and FtpServer on the classpath, and running the
following test case exposes the bug:

import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.channels.Channels;

import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.FtpServerFactory;
import org.apache.ftpserver.listener.ListenerFactory;

public class HarmonyFtpClient {

    public static void main(String[] args) throws Exception {

        FtpServerFactory fsf = new FtpServerFactory();
        ListenerFactory listenerFactory = new ListenerFactory();

        fsf.addListener("default", listenerFactory.createListener());

        FtpServer server = fsf.createServer();

        try {
            Socket socket = new Socket();
            socket.connect(new InetSocketAddress("localhost", 2121));
        } finally {

Throws the following exception:
java.net.SocketException: No such file or directory
	at org.apache.harmony.luni.platform.OSNetworkSystem.read(OSNetworkSystem.java)
	at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:557)
	at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:61)
	at HarmonyFtpClient.main(HarmonyFtpClient.java:27)


View raw message