diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-19 15:08:22 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-19 15:08:22 +0000 |
commit | 8db76ca933c641a7b60834003cd77e4ee4b99c49 (patch) | |
tree | 79455d0849bdbde550daa14a232718f903499cff /libjava/java/net/ServerSocket.java | |
parent | 208f6aa90d7709852c3c07ac158a0f9cc0a410b4 (diff) | |
download | ppe42-gcc-8db76ca933c641a7b60834003cd77e4ee4b99c49.tar.gz ppe42-gcc-8db76ca933c641a7b60834003cd77e4ee4b99c49.zip |
2003-06-19 Michael Koch <konqueror@gmx.de>
* java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/SocketImpl.java,
java/net/URLClassLoader.java:
Reworked import statements.
* java/net/InetAddress.java
(getByAddress): Simplified.
* java/net/ServerSocket.java
(ServerSocket): Moved special handling during bind operation to
bind().
(bind): Handle different cases when trying to bind a socket.
* java/net/URLConnection.java
(getHeaderFieldDate): Merged with classpath.
(getHeaderFieldInt): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68198 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net/ServerSocket.java')
-rw-r--r-- | libjava/java/net/ServerSocket.java | 89 |
1 files changed, 41 insertions, 48 deletions
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index 2d04eac452f..8dd420bbd3b 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -157,57 +157,11 @@ public class ServerSocket if (impl == null) throw new IOException("Cannot initialize Socket implementation"); - SecurityManager s = System.getSecurityManager(); - if (s != null) - s.checkListen(port); - - if (bindAddr == null) - bindAddr = InetAddress.ANY_IF; - // create socket impl.create(true); - // bind to address/port - try - { - impl.bind(bindAddr, port); - } - catch (IOException exception) - { - impl.close(); - throw exception; - } - catch (RuntimeException exception) - { - impl.close(); - throw exception; - } - catch (Error error) - { - impl.close(); - throw error; - } - - // listen on socket - try - { - impl.listen(backlog); - } - catch (IOException exception) - { - impl.close(); - throw exception; - } - catch (RuntimeException exception) - { - impl.close(); - throw exception; - } - catch (Error error) - { - impl.close(); - throw error; - } + // bind/listen socket + bind (new InetSocketAddress (bindAddr, port), backlog); } /** @@ -258,9 +212,48 @@ public class ServerSocket if (s != null) s.checkListen (tmp.getPort ()); + // bind to address/port + try + { impl.bind (tmp.getAddress (), tmp.getPort ()); + } + catch (IOException exception) + { + impl.close(); + throw exception; + } + catch (RuntimeException exception) + { + impl.close(); + throw exception; + } + catch (Error error) + { + impl.close(); + throw error; + } + + // listen on socket + try + { impl.listen(backlog); } + catch (IOException exception) + { + impl.close(); + throw exception; + } + catch (RuntimeException exception) + { + impl.close(); + throw exception; + } + catch (Error error) + { + impl.close(); + throw error; + } + } /** * This method returns the local address to which this socket is bound |