3 /* Copyright (C) 1999 Cygnus Solutions
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
12 * @author Per Bothner <bothner@cygnus.com>
13 * @date January 6, 1999.
16 /** Written using on-line Java Platform 1.2 API Specification.
17 * Status: I believe all methods are implemented, but many
18 * of them just throw an exception.
24 public class ServerSocket
26 static SocketImplFactory factory
;
29 public ServerSocket (int port
)
30 throws java
.io
.IOException
35 public ServerSocket (int port
, int backlog
)
36 throws java
.io
.IOException
38 this(port
, backlog
, InetAddress
.getLocalHost());
41 public ServerSocket (int port
, int backlog
, InetAddress bindAddr
)
42 throws java
.io
.IOException
45 this.impl
= new PlainSocketImpl();
47 this.impl
= factory
.createSocketImpl();
48 SecurityManager s
= System
.getSecurityManager();
52 impl
.bind(bindAddr
, port
);
56 public InetAddress
getInetAddress()
58 return impl
.getInetAddress();
61 public int getLocalPort()
63 return impl
.getLocalPort();
66 public Socket
accept () throws IOException
68 Socket s
= new Socket(Socket
.factory
== null ?
new PlainSocketImpl()
69 : Socket
.factory
.createSocketImpl());
74 protected final void implAccept (Socket s
) throws IOException
79 public void close () throws IOException
84 public void setSoTimeout (int timeout
) throws SocketException
86 throw new InternalError("ServerSocket.setSoTimeout not implemented");
89 public int getSoTimeout () throws SocketException
91 throw new InternalError("ServerSocket.getSoTimeout not implemented");
94 public String
toString ()
96 return impl
.toString();
99 public static void setSocketImplFactory (SocketImplFactory fac
)