[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.dsdp.tm] Re: RSE:How to set timeout to stop the connecting state?

Hi David,
My configuration:
- Windows XP PC running Eclipse 3.3.0 with plugin RSE (RSE-SDK-3.0.1.zip)

The class of org.apache.commons.net.SocketClient has not the method:

/**
* Sets the connection timeout in milliseconds, which will be passed to the {@link Socket} object's
* connect() method.
* @param connectTimeout The connection timeout to use (in ms)
* @since 2.0
*/
public void setConnectTimeout(int connectTimeout) {
this.connectTimeout = connectTimeout;
}


but has the two methods:
/**
 * Set the timeout in milliseconds of a currently open connection.
 * Only call this method after a connection has been opened
 * by {@link #connect connect()}.
 * <p>
 * @param timeout  The timeout in milliseconds to use for the currently
 *                 open socket connection.
 * @exception SocketException If the operation fails.
 */
   public void setSoTimeout(int timeout) throws SocketException
   {
       _socket_.setSoTimeout(timeout);
   }


/** * Set the default timeout in milliseconds to use when opening a socket. * This value is only used previous to a call to * {@link #connect connect()} * and should not be confused with {@link #setSoTimeout setSoTimeout()} * which operates on an the currently opened socket. _timeout_ contains * the new timeout value. * <p> * @param timeout The timeout in milliseconds to use for the socket * connection. */ public void setDefaultTimeout(int timeout) { _timeout_ = timeout; }

I use one of the two methods to set connect timeout(60000ms) , but it will cause another problem of "java.net.SocketTimeoutException: Read timed out"when a connection connected ftp server and wait a bit about 60000ms and transmit a file , then the SocketTimeoutException error occurred.

Have you another method to set connection timeout? How to deal with this problem?
Thanks ahead of time,
hemeihua