diff options
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 2d04eac..8dd420b 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 |