com.enterprisedt.net.ftp
Class SocketUtils
java.lang.Object
com.enterprisedt.net.ftp.SocketUtils
public class SocketUtils
- extends Object
Utility class that allows 1.4 socket methods to be called while
still being able to be compiled in 1.1.x
- Version:
- $Revision: 1.4 $
- Author:
- Bruce Blackshaw
Method Summary |
static Socket |
createSocket(InetAddress host,
int port,
int timeout)
Create a connected socket, using a timeout if it is available. |
static boolean |
isConnected(Socket sock)
Test if a socket is connected by using the isConnected method, only
available from JRE 1.4+. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SocketUtils
public SocketUtils()
createSocket
public static Socket createSocket(InetAddress host,
int port,
int timeout)
throws IOException
- Create a connected socket, using a timeout if it is available.
Availability is tested by trying to create instances of the
required classes and methods (JRE 1.4+)
- Parameters:
host
- remote host to connect toport
- port on remote hosttimeout
- timeout in milliseconds on
- Throws:
IOException
isConnected
public static boolean isConnected(Socket sock)
throws IOException
- Test if a socket is connected by using the isConnected method, only
available from JRE 1.4+. So invoke using reflection. If can't check
it assumes the socket is connected.
- Parameters:
sock
- socket to test
- Throws:
IOException
Copyright © 2000-2007 Enterprise Distributed Technologies. All Rights Reserved.