[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug inetlib/27873] New: Non-blocking SocketChannel signals connection r
From: |
james dot greenfield at gmail dot com |
Subject: |
[Bug inetlib/27873] New: Non-blocking SocketChannel signals connection refused prematurely |
Date: |
2 Jun 2006 09:39:21 -0000 |
This is trivially reproducible using the class below.
Compile and run with _no_ server listening on port 8080. Classpath raises a
ConnectException immediately:
java.net.ConnectException: Connection refused
at gnu.java.net.VMPlainSocketImpl.connect(Native Method)
at gnu.java.net.VMPlainSocketImpl.connect(VMPlainSocketImpl.java:295)
at gnu.java.net.PlainSocketImpl.connect(PlainSocketImpl.java:239)
at java.net.Socket.connect(Socket.java:440)
at gnu.java.nio.SocketChannelImpl.connect(SocketChannelImpl.java:150)
at TestNonBlockingConnect.main(TestNonBlockingConnect.java:10)
As I understand the NIO API this is incorrect. The connection refused should
only be signalled when SocketChannel.finishConnect() is called.
On Sun's 1.4.2_11 runtime this doesn't raise an exception (it exits after
printing "Connection requested".
I've taken a look to see if I can see the bug in the code in CVS but no joy so
far. I'll keep looking and update this bug if I find anything.
---------- TestNonBlockingConnect ----------------------
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
public class TestNonBlockingConnect {
public static void main(String[] args) throws Exception {
SocketChannel clientChannel = SocketChannel.open();
clientChannel.configureBlocking(false);
// Send a connection request to the server; this method is
non-blocking
clientChannel.connect(new InetSocketAddress("localhost",
8080));
System.out.println("Connection requested");
}
}
--
Summary: Non-blocking SocketChannel signals connection refused
prematurely
Product: classpath
Version: 0.91
Status: UNCONFIRMED
Severity: blocker
Priority: P3
Component: inetlib
AssignedTo: dog at gnu dot org
ReportedBy: james dot greenfield at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27873
- [Bug inetlib/27873] New: Non-blocking SocketChannel signals connection refused prematurely,
james dot greenfield at gmail dot com <=