*) Adding timeout to ftpc.java

See: http://www.yacy-forum.de/viewtopic.php?t=2268
   

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2035 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent 76ea16a6cb
commit a10072b5c0

@ -96,6 +96,9 @@ public class ftpc {
// client socket for commands // client socket for commands
private Socket ControlSocket = null; private Socket ControlSocket = null;
// socket timeout
private int ControlSocketTimeout = 300000;
// socket for data transactions // socket for data transactions
private ServerSocket DataSocketActive = null; private ServerSocket DataSocketActive = null;
private Socket DataSocketPassive = null; private Socket DataSocketPassive = null;
@ -1187,6 +1190,7 @@ cd ..
} }
try { try {
ControlSocket = new Socket(cmd[1], port); ControlSocket = new Socket(cmd[1], port);
ControlSocket.setSoTimeout(this.ControlSocketTimeout);
clientInput = new BufferedReader(new InputStreamReader(ControlSocket.getInputStream())); clientInput = new BufferedReader(new InputStreamReader(ControlSocket.getInputStream()));
clientOutput = new DataOutputStream(new BufferedOutputStream(ControlSocket.getOutputStream())); clientOutput = new DataOutputStream(new BufferedOutputStream(ControlSocket.getOutputStream()));
@ -1795,6 +1799,14 @@ cd ..
if (Integer.parseInt(reply.substring(0, 1)) == 5) throw new IOException(reply); if (Integer.parseInt(reply.substring(0, 1)) == 5) throw new IOException(reply);
} }
public int getTimeout() {
return this.ControlSocketTimeout;
}
public void setTimeout(int timeout) {
this.ControlSocketTimeout = timeout;
}
class ee extends SecurityException { class ee extends SecurityException {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

Loading…
Cancel
Save