X-Git-Url: http://git.megacz.com/?p=org.ibex.io.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fio%2FConnection.java;h=1ab0abe00646ae5da6d37c91d9a4cf1c135dfb5f;hp=5c8c0fdc435f61897150089a0dbe9484417edaee;hb=5f7d531015927476bffd668f0a28960a60399093;hpb=af2b1cfb120eb3c922191685cd42ecceb8523f78 diff --git a/src/org/ibex/io/Connection.java b/src/org/ibex/io/Connection.java index 5c8c0fd..1ab0abe 100644 --- a/src/org/ibex/io/Connection.java +++ b/src/org/ibex/io/Connection.java @@ -15,13 +15,17 @@ public class Connection extends Stream { public Connection(Socket s, String vhost) { super(s); this.vhost = vhost; this.s = s; } protected Connection(InputStream i, OutputStream o) { super(i, o); vhost = null; s = null; } public Socket getSocket() { return s; } - public void close() { try{if (s!=null) s.close();}catch(Exception e){throw new Stream.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(); } public String getVirtualHost() { return vhost; } - public void setTimeout(int ms) { try { s.setSoTimeout(ms); } catch (Exception e){throw new Stream.StreamException(e); }} - public void setTcpNoDelay(boolean delay) { try { s.setTcpNoDelay(delay);}catch(Exception e){throw new Stream.StreamException(e); }} + public void setTimeout(int ms) { try { s.setSoTimeout(ms); } catch(IOException e) { ioe(e); } } + public void setTcpNoDelay(boolean delay) { try { s.setTcpNoDelay(delay); } catch(IOException e) { ioe(e); } } + + /** never throws an exception */ + public void close() { try{if (s!=null) s.close();}catch(Exception e){/*ignore*/} super.close(); } } +