From: adam Date: Sat, 30 Oct 2004 08:47:21 +0000 (+0000) Subject: added getLocalAddress() and print() X-Git-Url: http://git.megacz.com/?p=org.ibex.io.git;a=commitdiff_plain;h=ed380c04d86942dcb21506d27af41f81d0d29a1f added getLocalAddress() and print() darcs-hash:20041030084721-5007d-4e9326557bcf86e1bbead8d8a11d28cfa0717873.gz --- diff --git a/src/org/ibex/io/Connection.java b/src/org/ibex/io/Connection.java index 4233315..a6eda45 100644 --- a/src/org/ibex/io/Connection.java +++ b/src/org/ibex/io/Connection.java @@ -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(); } diff --git a/src/org/ibex/io/Stream.java b/src/org/ibex/io/Stream.java index 9de0322..51fe9f6 100644 --- a/src/org/ibex/io/Stream.java +++ b/src/org/ibex/io/Stream.java @@ -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); } }