X-Git-Url: http://git.megacz.com/?p=org.ibex.io.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fio%2FConnection.java;h=5c8d148cbdb0ce6ef88c011384faa9990939b0de;hp=bb7907b787f2cfd3fa7ecb6d52e04518065b6fef;hb=90f95bb2b7ec4e97fa14a3426d1bf3127735da8d;hpb=1ec9169c1ca9b270c6b94e0a8499b20eb9f59ba6 diff --git a/src/org/ibex/io/Connection.java b/src/org/ibex/io/Connection.java index bb7907b..5c8d148 100644 --- a/src/org/ibex/io/Connection.java +++ b/src/org/ibex/io/Connection.java @@ -1,4 +1,7 @@ -// Copyright 2004 Adam Megacz, see the COPYING file for licensing [LGPL] +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the Apache Public Source License 2.0 ("the License"). +// You may not use this file except in compliance with the License. + package org.ibex.io; import java.net.*; @@ -10,11 +13,14 @@ public class Connection extends Stream { private final Socket s; public final String vhost; public Connection(Socket s, String vhost) { super(s); this.vhost = vhost; this.s = s; } + public Socket getSocket() { return s; } + public void close() { try{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 StreamException(e); }} - public void setTcpNoDelay(boolean delay) { try { s.setTcpNoDelay(delay);}catch(Exception e){throw new StreamException(e); }} + 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); }} }