Author: gnodet
Date: Fri Dec  4 19:47:43 2009
New Revision: 887332

URL: http://svn.apache.org/viewvc?rev=887332&view=rev
Log:
SSHD-65: Ability to specify the host name when binding the sshd server socket

Modified:
    mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/SshServer.java

Modified: mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/SshServer.java
URL: 
http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/SshServer.java?rev=887332&r1=887331&r2=887332&view=diff
==============================================================================
--- mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/SshServer.java 
(original)
+++ mina/sshd/trunk/sshd-core/src/main/java/org/apache/sshd/SshServer.java Fri 
Dec  4 19:47:43 2009
@@ -108,6 +108,7 @@
 public class SshServer extends AbstractFactoryManager implements 
ServerFactoryManager {
 
     protected IoAcceptor acceptor;
+    protected String host;
     protected int port;
     protected int backlog = 50;
     protected boolean reuseAddress = true;
@@ -124,6 +125,14 @@
     public SshServer() {
     }
 
+    public String getHost() {
+        return host;
+    }
+
+    public void setHost(String host) {
+        this.host = host;
+    }
+
     public int getPort() {
         return port;
     }
@@ -272,7 +281,7 @@
         handler.setServer(this);
         acceptor.setHandler(handler);
 
-        acceptor.bind(new InetSocketAddress(port));
+        acceptor.bind(host != null ? new InetSocketAddress(host, port) : new 
InetSocketAddress(port));
         if (port == 0) {
             port = ((InetSocketAddress) acceptor.getLocalAddress()).getPort();
         }


Reply via email to