se.ericsson.eto.norarc.javaframe
Class TimedSocket

java.lang.Object
  extended byse.ericsson.eto.norarc.javaframe.TimedSocket

class TimedSocket
extends java.lang.Object

This class offers a timeout feature on socket connections. A maximum length of time allowed for a connection can be specified, along with a host and port.

Author:
David Reilly

Nested Class Summary
(package private) static class TimedSocket.SocketThread
           
 
Constructor Summary
(package private) TimedSocket()
           
 
Method Summary
static java.net.Socket getSocket(java.net.InetAddress addr, int port, int delay)
          Attempts to connect to a service at the specified address and port, for a specified maximum amount of time.
static java.net.Socket getSocket(java.lang.String host, int port, int delay)
          Attempts to connect to a service at the specified address and port, for a specified maximum amount of time.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimedSocket

TimedSocket()
Method Detail

getSocket

public static java.net.Socket getSocket(java.net.InetAddress addr,
                                        int port,
                                        int delay)
                                 throws java.io.InterruptedIOException,
                                        java.io.IOException
Attempts to connect to a service at the specified address and port, for a specified maximum amount of time.

Parameters:
addr - Address of host
port - Port of service
delay - Delay in milliseconds
Throws:
java.io.InterruptedIOException
java.io.IOException

getSocket

public static java.net.Socket getSocket(java.lang.String host,
                                        int port,
                                        int delay)
                                 throws java.io.InterruptedIOException,
                                        java.io.IOException
Attempts to connect to a service at the specified address and port, for a specified maximum amount of time.

Parameters:
host - Hostname of machine
port - Port of service
delay - Delay in milliseconds
Throws:
java.io.InterruptedIOException
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception