|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ipworks.Tftp
The TFTPClient control is used to exchange files with TFTP servers via the TFTP protocol.
To use the control, first specify the TFTPServer
, then
a LocalFile
and a RemoteFile
, and set the Action
property to either tftpGetFile or tftpPutFile or call the equivalent methods. The Transfer
event shows the progress of the transfer.
Potential transmission errors and packet loss are managed by the Timeout
property which controls the maximum time to
wait for a response from the server, and the MaxRetransmits
property which specifies how many times to resend a failed
packet before giving up.
Field Summary | |
static int |
tftpGetFile
|
static int |
tftpIdle
|
static int |
tftpPutFile
|
Constructor Summary | |
Tftp()
|
Method Summary | |
void |
addTftpEventListener(TftpEventListener l)
|
void |
fireEndTransfer()
Fired when a file completes downloading/uploading. |
void |
fireError(int errorCode,
java.lang.String description)
Information about errors during data delivery. |
void |
fireStartTransfer()
Fired when a file starts downloading/uploading. |
void |
fireTransfer(int bytesTransferred,
byte[] text)
Fired during file download/upload. |
int |
getAction()
An action code for the control. |
void |
getFile()
Download a RemoteFile from the TFTP server. |
java.lang.String |
getLocalFile()
The file on the local host to transfer the data to/from. |
java.lang.String |
getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
int |
getMaxRetransmits()
The number of times to retry sending a failed packet before disconnecting. |
java.lang.String |
getRemoteFile()
The file on the remote host. |
int |
getRetransmitTimeout()
Maximum time in seconds to wait for a reply packet from the server before retransmitting the last packet. |
int |
getTFTPPort()
The UDP port where the remote TFTP server is listening. |
java.lang.String |
getTFTPServer()
The address of the TFTP server to exchange files with. |
int |
getTimeout()
A timeout for the component. |
void |
interrupt()
Interrupt the Action in progress (if any). |
void |
putFile()
Upload a file specified by LocalFile to the TFTP server. |
void |
removeTftpEventListener(TftpEventListener l)
|
void |
setAction(int action)
An action code for the control. |
void |
setLocalFile(java.lang.String localFile)
The file on the local host to transfer the data to/from. |
void |
setLocalHost(java.lang.String localHost)
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
void |
setMaxRetransmits(int maxRetransmits)
The number of times to retry sending a failed packet before disconnecting. |
void |
setRemoteFile(java.lang.String remoteFile)
The file on the remote host. |
void |
setRetransmitTimeout(int retransmitTimeout)
Maximum time in seconds to wait for a reply packet from the server before retransmitting the last packet. |
void |
setTFTPPort(int TFTPPort)
The UDP port where the remote TFTP server is listening. |
void |
setTFTPServer(java.lang.String TFTPServer)
The address of the TFTP server to exchange files with. |
void |
setTimeout(int timeout)
A timeout for the component. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int tftpIdle
public static final int tftpGetFile
public static final int tftpPutFile
Constructor Detail |
public Tftp()
Method Detail |
public int getAction()
Action
property and
the corresponding descriptions:
TFTPServer
for the file specified by RemoteFile
. If LocalFile
points to a valid file, the data
is received in LocalFile
, otherwise the data is received through
the through the Transfer
event.
TFTPServer
and the file specified
by LocalFile
is sent to RemoteFile
in the TFTPServer
.
After a successful transfer, the control returns control, and the Action
property converts to tftpIdle .
public void setAction(int action) throws IPWorksException
Action
property and
the corresponding descriptions:
TFTPServer
for the file specified by RemoteFile
. If LocalFile
points to a valid file, the data
is received in LocalFile
, otherwise the data is received through
the through the Transfer
event.
TFTPServer
and the file specified
by LocalFile
is sent to RemoteFile
in the TFTPServer
.
After a successful transfer, the control returns control, and the Action
property converts to tftpIdle .
public java.lang.String getLocalFile()
Action
is tftpGetFile and the file already exists, it is overwritten.
If Action
is tftpPutFile , LocalFile
must point to a valid file,
or an error will be returned.
public void setLocalFile(java.lang.String localFile) throws IPWorksException
Action
is tftpGetFile and the file already exists, it is overwritten.
If Action
is tftpPutFile , LocalFile
must point to a valid file,
or an error will be returned.
public java.lang.String getLocalHost()
LocalHost
property contains the name of the local host
as obtained by the gethostname() Winsock call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.
If the control is connected, the LocalHost
property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost
is not persistent. You must always set it in
code, and never in the property window.
public void setLocalHost(java.lang.String localHost) throws IPWorksException
LocalHost
property contains the name of the local host
as obtained by the gethostname() Winsock call, or if the
user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.
If the control is connected, the LocalHost
property shows
the IP address of the interface through which the connection
is made in internet dotted format (aaa.bbb.ccc.ddd). In most
cases, this is the address of the local host, except for multihomed
hosts (machines with more than one IP interface).
NOTE: LocalHost
is not persistent. You must always set it in
code, and never in the property window.
public int getMaxRetransmits()
The RetransmitTimeout
determines the wait time (in seconds)
between successive retransmissions.
The default value for the MaxRetransmits
property is 3.
public void setMaxRetransmits(int maxRetransmits) throws IPWorksException
The RetransmitTimeout
determines the wait time (in seconds)
between successive retransmissions.
The default value for the MaxRetransmits
property is 3.
public java.lang.String getRemoteFile()
Action
is 'Get File', this must be a valid file on
the TFTPServer
.
public void setRemoteFile(java.lang.String remoteFile) throws IPWorksException
Action
is 'Get File', this must be a valid file on
the TFTPServer
.
public int getRetransmitTimeout()
MaxRetransmits
property for the number of
retransmit efforts before an error is returned.
The default value for the RetransmitTimeout
is 5 seconds.
public void setRetransmitTimeout(int retransmitTimeout) throws IPWorksException
MaxRetransmits
property for the number of
retransmit efforts before an error is returned.
The default value for the RetransmitTimeout
is 5 seconds.
public int getTFTPPort()
TFTPPort
is the UDP port on the TFTPServer
where to
send TFTP requests to.
public void setTFTPPort(int TFTPPort) throws IPWorksException
TFTPPort
is the UDP port on the TFTPServer
where to
send TFTP requests to.
public java.lang.String getTFTPServer()
TFTPPort
(default 69).
public void setTFTPServer(java.lang.String TFTPServer) throws IPWorksException
TFTPPort
(default 69).
public int getTimeout()
Timeout
property is set to 0 (default value) all actions
will run uninterrupted until succesful completion, or an error condition
is encountered.
If Timeout
is set to a positive value, and any action does not
complete within Timeout
seconds, the action is aborted, and a 'Timeout' error is fired..
The control will use DoEvents
to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and always remains responsive.
public void setTimeout(int timeout) throws IPWorksException
Timeout
property is set to 0 (default value) all actions
will run uninterrupted until succesful completion, or an error condition
is encountered.
If Timeout
is set to a positive value, and any action does not
complete within Timeout
seconds, the action is aborted, and a 'Timeout' error is fired..
The control will use DoEvents
to enter an efficient wait loop
during any potential waiting period, making sure that all system events
are processed immediately as they arrive. This ensures that the host
application does not "freeze" and always remains responsive.
public void fireEndTransfer()
TftpEndTransferEvent
public void fireError(int errorCode, java.lang.String description)
TftpErrorEvent
public void fireStartTransfer()
TftpStartTransferEvent
public void fireTransfer(int bytesTransferred, byte[] text)
TftpTransferEvent
public void getFile() throws IPWorksException
RemoteFile
is downloaded to the local file specified
by LocalFile
, or it is retrieved through the Transfer
event,
if the LocalFile
property is "" (empty string).
Calling this method is equivalent to setting the Action
property
to tftpGetFile .
public void interrupt() throws IPWorksException
Action
property
to Idle (0) .
public void putFile() throws IPWorksException
LocalFile
is uploaded to the remote file specified
by RemoteFile
.
Calling this method is equivalent to setting the Action
property
to tftpPutFile .
public void addTftpEventListener(TftpEventListener l) throws java.util.TooManyListenersException
public void removeTftpEventListener(TftpEventListener l)
|
![]() |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |