/[classpath]/classpath/gnu/java/nio/ServerSocketChannelImpl.java
ViewVC logotype

Diff of /classpath/gnu/java/nio/ServerSocketChannelImpl.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by mkoch, Tue Jun 10 19:39:08 2003 UTC revision 1.8 by mkoch, Wed Jun 18 09:45:00 2003 UTC
# Line 35  this exception to your version of the li Line 35  this exception to your version of the li
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
38    
39  package gnu.java.nio;  package gnu.java.nio;
40    
41  import java.io.IOException;  import java.io.IOException;
42  import java.net.InetSocketAddress;  import java.net.InetSocketAddress;
43  import java.net.ServerSocket;  import java.net.ServerSocket;
44    import java.net.Socket;
45  import java.net.SocketAddress;  import java.net.SocketAddress;
46  import java.nio.channels.ServerSocketChannel;  import java.nio.channels.ServerSocketChannel;
47  import java.nio.channels.SocketChannel;  import java.nio.channels.SocketChannel;
# Line 47  import java.nio.channels.spi.SelectorPro Line 49  import java.nio.channels.spi.SelectorPro
49    
50  class ServerSocketChannelImpl extends ServerSocketChannel  class ServerSocketChannelImpl extends ServerSocketChannel
51  {  {
52    ServerSocket sock_object;    ServerSocket serverSocket;
   int fd;  
   int local_port;  
53    boolean blocking = true;    boolean blocking = true;
54    boolean connected = false;    boolean connected = false;
   InetSocketAddress sa;  
   
   private static int NioSocketAccept (ServerSocketChannelImpl server,  
                                       SocketChannelImpl s)  
   {  
     return 0;  
   }  
55    
56    protected ServerSocketChannelImpl (SelectorProvider provider)    protected ServerSocketChannelImpl (SelectorProvider provider)
57      throws IOException      throws IOException
58    {    {
59      super (provider);      super (provider);
60      fd = SocketChannelImpl.SocketCreate ();      serverSocket = new ServerSocket ();
   
     try  
       {  
         sock_object = new ServerSocket ();  
       }  
     catch (IOException e)  
       {  
         System.err.println ("ServerSocket could not be created.");  
       }  
61    }    }
62    
63    public void finalizer()    public void finalizer()
# Line 93  class ServerSocketChannelImpl extends Se Line 77  class ServerSocketChannelImpl extends Se
77    protected void implCloseSelectableChannel () throws IOException    protected void implCloseSelectableChannel () throws IOException
78    {    {
79      connected = false;      connected = false;
80      SocketChannelImpl.SocketClose (fd);      serverSocket.close();
     fd = SocketChannelImpl.SocketCreate ();  
81    }    }
82    
83    protected void implConfigureBlocking (boolean blocking) throws IOException    protected void implConfigureBlocking (boolean blocking) throws IOException
84    {    {
85      this.blocking = blocking;      this.blocking = blocking; // FIXME
86    }    }
87    
88    public SocketChannel accept () throws IOException    public SocketChannel accept () throws IOException
89    {    {
90      SocketChannelImpl result = new SocketChannelImpl (provider ());      SocketChannelImpl result = new SocketChannelImpl (provider ());
91      result.sa = new InetSocketAddress (0);      Socket socket = serverSocket.accept();
92      int res = NioSocketAccept (this, result);      //socket.setChannel (result); // FIXME
93      return result;      return result;
94    }    }
95    
96    public ServerSocket socket ()    public ServerSocket socket ()
97    {    {
98      return sock_object;      return serverSocket;
99    }    }
100  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26