added getLocalAddress() and print()
authoradam <adam@megacz.com>
Sat, 30 Oct 2004 08:47:21 +0000 (08:47 +0000)
committeradam <adam@megacz.com>
Sat, 30 Oct 2004 08:47:21 +0000 (08:47 +0000)
darcs-hash:20041030084721-5007d-4e9326557bcf86e1bbead8d8a11d28cfa0717873.gz

src/org/ibex/io/Connection.java
src/org/ibex/io/Stream.java

index 4233315..a6eda45 100644 (file)
@@ -12,6 +12,7 @@ public class Connection extends Stream {
     public Connection(Socket s, String vhost) { super(s); this.vhost = vhost; this.s = s; }
     public void close()                       { try{s.close();}catch(Exception e){throw new StreamException(e);} super.close(); }
     public int getLocalPort()                 { return s.getLocalPort(); }
+    public InetAddress getLocalAddress()      { return ((InetSocketAddress)s.getLocalSocketAddress()).getAddress(); }
     public int getRemotePort()                { return s.getPort(); }
     public InetAddress getRemoteAddress()     { return ((InetSocketAddress)s.getRemoteSocketAddress()).getAddress(); }
     public String getRemoteHostname()         { return getRemoteAddress().getHostName(); }
index 9de0322..51fe9f6 100644 (file)
@@ -54,6 +54,7 @@ public class Stream {
     public void   unread(String s)                 { in.unread(s); }
 
     public void   println()                        { println(""); }
+    public void   print(String s)                  { logWrite(s); out.write(s); flush(); }
     public void   println(String s)                { logWrite(s); out.write(s); out.write(newLine); flush(); }
 
     public void   flush()                          { if (out != null) try { out.w.flush(); } catch(IOException e) { ioe(e); } }