| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectorg.apache.commons.net.DatagramSocketClientorg.apache.commons.net.tftp.TFTPorg.apache.commons.net.tftp.TFTPClientpublic class TFTPClientextends TFTPTFTP, TFTPPacket, TFTPPacketExceptionField Summary | |
static int |
|
private int |
|
Fields inherited from class org.apache.commons.net.tftp.TFTP | |
ASCII_MODE, BINARY_MODE, DEFAULT_PORT, DEFAULT_TIMEOUT, IMAGE_MODE, NETASCII_MODE, OCTET_MODE, PACKET_SIZE, __receiveBuffer, __receiveDatagram, __sendDatagram, _sendBuffer | |
Fields inherited from class org.apache.commons.net.DatagramSocketClient | |
__DEFAULT_SOCKET_FACTORY, _isOpen_, _socketFactory_, _socket_, _timeout_ | |
Constructor Summary | |
| |
Method Summary | |
int |
|
int |
|
int |
|
int |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class org.apache.commons.net.tftp.TFTP | |
beginBufferedOps, bufferedReceive, bufferedSend, discardPackets, endBufferedOps, getModeName, receive, send | |
Methods inherited from class org.apache.commons.net.DatagramSocketClient | |
close, getDefaultTimeout, getLocalAddress, getLocalPort, getSoTimeout, isOpen, open, open, open, setDatagramSocketFactory, setDefaultTimeout, setSoTimeout | |
public static final int DEFAULT_MAX_TIMEOUTS
The default number of times a receive attempt is allowed to timeout before ending attempts to retry the receive and failing. The default is 5 timeouts.
- Field Value:
- 5
private int __maxTimeouts
The maximum number of timeouts allowed before failing. **
public TFTPClient()
Creates a TFTPClient instance with a default timeout of DEFAULT_TIMEOUT, maximum timeouts value of DEFAULT_MAX_TIMEOUTS, a null socket, and buffered operations disabled.
public int getMaxTimeouts()
Returns the maximum number of times a receive attempt is allowed to timeout before ending attempts to retry the receive and failing.
- Returns:
- The maximum number of timeouts allowed.
public int receiveFile(String filename,
int mode,
OutputStream output,
InetAddress host)
throws IOExceptionSame as calling receiveFile(filename, mode, output, host, TFTP.DEFAULT_PORT).
- Parameters:
filename- The name of the file to receive.mode- The TFTP mode of the transfer (one of the MODE constants).output- The OutputStream to which the file should be written.host- The remote host serving the file.
public int receiveFile(String filename,
int mode,
OutputStream output,
InetAddress host,
int port)
throws IOExceptionRequests a named file from a remote host, writes the file to an OutputStream, closes the connection, and returns the number of bytes read. A local UDP socket must first be created by open() before invoking this method. This method will not close the OutputStream containing the file; you must close it after the method invocation.
- Parameters:
filename- The name of the file to receive.mode- The TFTP mode of the transfer (one of the MODE constants).output- The OutputStream to which the file should be written.host- The remote host serving the file.port- The port number of the remote TFTP server.
public int receiveFile(String filename,
int mode,
OutputStream output,
String hostname)
throws UnknownHostException,
IOExceptionSame as calling receiveFile(filename, mode, output, hostname, TFTP.DEFAULT_PORT).
- Parameters:
filename- The name of the file to receive.mode- The TFTP mode of the transfer (one of the MODE constants).output- The OutputStream to which the file should be written.hostname- The name of the remote host serving the file.
public int receiveFile(String filename,
int mode,
OutputStream output,
String hostname,
int port)
throws UnknownHostException,
IOExceptionRequests a named file from a remote host, writes the file to an OutputStream, closes the connection, and returns the number of bytes read. A local UDP socket must first be created by open() before invoking this method. This method will not close the OutputStream containing the file; you must close it after the method invocation.
- Parameters:
filename- The name of the file to receive.mode- The TFTP mode of the transfer (one of the MODE constants).output- The OutputStream to which the file should be written.hostname- The name of the remote host serving the file.port- The port number of the remote TFTP server.
public void sendFile(String filename,
int mode,
InputStream input,
InetAddress host)
throws IOExceptionSame as calling sendFile(filename, mode, input, host, TFTP.DEFAULT_PORT).
- Parameters:
filename- The name the remote server should use when creating the file on its file system.mode- The TFTP mode of the transfer (one of the MODE constants).host- The name of the remote host receiving the file.
public void sendFile(String filename,
int mode,
InputStream input,
InetAddress host,
int port)
throws IOExceptionRequests to send a file to a remote host, reads the file from an InputStream, sends the file to the remote host, and closes the connection. A local UDP socket must first be created by open() before invoking this method. This method will not close the InputStream containing the file; you must close it after the method invocation.
- Parameters:
filename- The name the remote server should use when creating the file on its file system.mode- The TFTP mode of the transfer (one of the MODE constants).host- The remote host receiving the file.port- The port number of the remote TFTP server.
public void sendFile(String filename,
int mode,
InputStream input,
String hostname)
throws UnknownHostException,
IOExceptionSame as calling sendFile(filename, mode, input, hostname, TFTP.DEFAULT_PORT).
- Parameters:
filename- The name the remote server should use when creating the file on its file system.mode- The TFTP mode of the transfer (one of the MODE constants).hostname- The name of the remote host receiving the file.
public void sendFile(String filename,
int mode,
InputStream input,
String hostname,
int port)
throws UnknownHostException,
IOExceptionRequests to send a file to a remote host, reads the file from an InputStream, sends the file to the remote host, and closes the connection. A local UDP socket must first be created by open() before invoking this method. This method will not close the InputStream containing the file; you must close it after the method invocation.
- Parameters:
filename- The name the remote server should use when creating the file on its file system.mode- The TFTP mode of the transfer (one of the MODE constants).hostname- The name of the remote host receiving the file.port- The port number of the remote TFTP server.
public void setMaxTimeouts(int numTimeouts)
Sets the maximum number of times a receive attempt is allowed to timeout during a receiveFile() or sendFile() operation before ending attempts to retry the receive and failing. The default is DEFAULT_MAX_TIMEOUTS.
- Parameters:
numTimeouts- The maximum number of timeouts to allow. Values less than 1 should not be used, but if they are, they are treated as 1.