org.xnap.net
Class NetHelper

java.lang.Object
  extended by org.xnap.net.NetHelper

public class NetHelper
extends java.lang.Object

Provides a set of static methods for common network tasks.


Nested Class Summary
static class NetHelper.SocketConnector
           
 
Constructor Summary
NetHelper()
           
 
Method Summary
static java.net.Socket connect(java.lang.String host, int port, long timeout)
           
static void disableHttpProxy()
          Disables the use of a http proxy.
static void disableSocksProxy()
          Disables the use of a socks proxy.
static void enableHttpProxy(java.lang.String host, int port)
          Enables the use of a http proxy at host:port.
static void enableSocksProxy(java.lang.String host, int port)
          Enables the use of a socks proxy at host:port.
static java.lang.String getErrorMessage(java.io.IOException e)
          Returns a sensible error message.
static long ipToLongHiFirst(byte[] address)
           
static java.lang.String toIP(long ip)
          Converts ip from an integer value to a dotted string representation.
static java.lang.String toIP(java.lang.String ip)
          Converts ip from an integer value to a dotted string representation.
static java.lang.String toIPHiFirst(long ip)
          Converts ip from an integer value to a dotted string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetHelper

public NetHelper()
Method Detail

enableSocksProxy

public static void enableSocksProxy(java.lang.String host,
                                    int port)
Enables the use of a socks proxy at host:port.

Parameters:
host - hostname of the proxy
host - port of the proxy

disableSocksProxy

public static void disableSocksProxy()
Disables the use of a socks proxy.


enableHttpProxy

public static void enableHttpProxy(java.lang.String host,
                                   int port)
Enables the use of a http proxy at host:port.

Parameters:
host - hostname of the proxy
host - port of the proxy

disableHttpProxy

public static void disableHttpProxy()
Disables the use of a http proxy.


getErrorMessage

public static java.lang.String getErrorMessage(java.io.IOException e)
Returns a sensible error message.


ipToLongHiFirst

public static long ipToLongHiFirst(byte[] address)

toIP

public static java.lang.String toIP(java.lang.String ip)
Converts ip from an integer value to a dotted string representation.

See Also:
toIP(long)

toIP

public static java.lang.String toIP(long ip)
Converts ip from an integer value to a dotted string representation.


toIPHiFirst

public static java.lang.String toIPHiFirst(long ip)
Converts ip from an integer value to a dotted string representation.


connect

public static java.net.Socket connect(java.lang.String host,
                                      int port,
                                      long timeout)
                               throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2001-2005 XNap Team. All Rights Reserved.