public class SocketUtils
extends java.lang.Object
Constructor and Description |
---|
SocketUtils() |
Modifier and Type | Method and Description |
---|---|
static java.net.Socket |
createSocket(java.net.InetAddress host,
int port,
int timeout)
Create a connected socket, using a timeout if it is available.
|
static boolean |
isConnected(java.net.Socket sock)
Test if a socket is connected by using the isConnected method, only
available from JRE 1.4+.
|
public static java.net.Socket createSocket(java.net.InetAddress host, int port, int timeout) throws java.io.IOException
host
- remote host to connect toport
- port on remote hosttimeout
- timeout in milliseconds onjava.io.IOException
public static boolean isConnected(java.net.Socket sock) throws java.io.IOException
sock
- socket to testjava.io.IOException