org.opennms.netmgt.utils
Class SocketChannelUtil
java.lang.Object
org.opennms.netmgt.utils.SocketChannelUtil
public class SocketChannelUtil
- extends Object
Class to obtain a connected SocketChannel object.
- Author:
- Tarus Balog , OpenNMS
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SocketChannelUtil
public SocketChannelUtil()
getConnectedSocketChannel
public static SocketChannel getConnectedSocketChannel(InetAddress host,
int port,
int timeout)
throws IOException,
InterruptedException
- This will attempt to connect to the passed host and port. The connection
will be made in non-blocking mode, so if there is no route to the host,
then it won't hold up capsd or the poller.
Once a connection is made, the channel is returned to blocking mode.
- Parameters:
host - remote hostport - porttimeout - timeout (ms)
- Returns:
- SocketChannel object already connected to the remote host/port
pair.
- Throws:
IOException
InterruptedException
Copyright © 2009. All Rights Reserved.