From f80652ec3090e09e9cb8796b34f2f4ae9a5998e4 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Wed, 18 Jun 2003 09:45:00 +0000 Subject: 2003-06-18 Michael Koch * gnu/java/nio/FileChannelImpl.java, gnu/java/nio/SelectorImpl.java, gnu/java/nio/ServerSocketChannelImpl.java, gnu/java/nio/SocketChannelImpl.java, java/nio/DirectByteBufferImpl.java: New versions from libgcj. --- gnu/java/nio/ServerSocketChannelImpl.java | 35 ++++++++----------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'gnu/java/nio/ServerSocketChannelImpl.java') diff --git a/gnu/java/nio/ServerSocketChannelImpl.java b/gnu/java/nio/ServerSocketChannelImpl.java index 3b5dc88af..05ad0aefc 100644 --- a/gnu/java/nio/ServerSocketChannelImpl.java +++ b/gnu/java/nio/ServerSocketChannelImpl.java @@ -35,11 +35,13 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package gnu.java.nio; import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; +import java.net.Socket; import java.net.SocketAddress; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; @@ -47,33 +49,15 @@ import java.nio.channels.spi.SelectorProvider; class ServerSocketChannelImpl extends ServerSocketChannel { - ServerSocket sock_object; - int fd; - int local_port; + ServerSocket serverSocket; boolean blocking = true; boolean connected = false; - InetSocketAddress sa; - - private static int NioSocketAccept (ServerSocketChannelImpl server, - SocketChannelImpl s) - { - return 0; - } protected ServerSocketChannelImpl (SelectorProvider provider) throws IOException { super (provider); - fd = SocketChannelImpl.SocketCreate (); - - try - { - sock_object = new ServerSocket (); - } - catch (IOException e) - { - System.err.println ("ServerSocket could not be created."); - } + serverSocket = new ServerSocket (); } public void finalizer() @@ -93,25 +77,24 @@ class ServerSocketChannelImpl extends ServerSocketChannel protected void implCloseSelectableChannel () throws IOException { connected = false; - SocketChannelImpl.SocketClose (fd); - fd = SocketChannelImpl.SocketCreate (); + serverSocket.close(); } protected void implConfigureBlocking (boolean blocking) throws IOException { - this.blocking = blocking; + this.blocking = blocking; // FIXME } public SocketChannel accept () throws IOException { SocketChannelImpl result = new SocketChannelImpl (provider ()); - result.sa = new InetSocketAddress (0); - int res = NioSocketAccept (this, result); + Socket socket = serverSocket.accept(); + //socket.setChannel (result); // FIXME return result; } public ServerSocket socket () { - return sock_object; + return serverSocket; } } -- cgit v1.2.1