pyrasun.eio.util
Class EIOUtil

java.lang.Object
  extended bypyrasun.eio.util.EIOUtil

public class EIOUtil
extends java.lang.Object

Me pappy told me many moons ago that you can't have a real library without a utility class - so here ya go, pops.


Constructor Summary
EIOUtil()
           
 
Method Summary
static java.nio.channels.SocketChannel createClient(java.net.InetSocketAddress sockAddr, int timeout)
          Create a socket client.
static java.nio.channels.SocketChannel createClient(java.lang.String host, int port)
          Create a socket client.
static java.nio.channels.SocketChannel createClient(java.lang.String host, int port, int timeout)
          Create a socket client.
static java.nio.channels.ServerSocketChannel createServer(java.net.InetSocketAddress sockAddr)
          Create a ServerSocketChannel using the specified InetSocketAddress.
static java.nio.channels.ServerSocketChannel createServer(int port)
          Create a ServerSocketChannel on the default socket interface w/ the specified port.
static java.nio.channels.ServerSocketChannel createServer(java.lang.String host, int port)
          Create a ServerSocketChannel on the specified host w/ the specified port.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EIOUtil

public EIOUtil()
Method Detail

createServer

public static java.nio.channels.ServerSocketChannel createServer(java.lang.String host,
                                                                 int port)
                                                          throws java.io.IOException
Create a ServerSocketChannel on the specified host w/ the specified port.

Parameters:
host - - DNS name or IP address of the host. This parameter must resolve to a valid interface on the local machine
port - - Port number to bind the server to.
Throws:
java.io.IOException

createServer

public static java.nio.channels.ServerSocketChannel createServer(int port)
                                                          throws java.io.IOException
Create a ServerSocketChannel on the default socket interface w/ the specified port. This is fine for single NIC machines, not so good for machines with multiple NICs.

Parameters:
port - - Port number to bind the server to.
Throws:
java.io.IOException

createServer

public static java.nio.channels.ServerSocketChannel createServer(java.net.InetSocketAddress sockAddr)
                                                          throws java.io.IOException
Create a ServerSocketChannel using the specified InetSocketAddress.

Throws:
java.io.IOException

createClient

public static java.nio.channels.SocketChannel createClient(java.lang.String host,
                                                           int port)
                                                    throws java.io.IOException
Create a socket client.

Throws:
java.io.IOException

createClient

public static java.nio.channels.SocketChannel createClient(java.lang.String host,
                                                           int port,
                                                           int timeout)
                                                    throws java.io.IOException
Create a socket client.

Throws:
java.io.IOException

createClient

public static java.nio.channels.SocketChannel createClient(java.net.InetSocketAddress sockAddr,
                                                           int timeout)
                                                    throws java.io.IOException
Create a socket client.

Throws:
java.io.IOException


Pyrasun EmberIO