public final class TFTPAckPacket extends TFTPPacket
Details regarding the TFTP protocol and the format of TFTP packets can be found in RFC 783. But the point of these classes is to keep you from having to
worry about the internals. Additionally, only very few people should have to care about any of the TFTPPacket classes or derived classes. Almost all users
should only be concerned with the TFTPClient class receiveFile() and sendFile() methods.
TFTPPacket,
TFTPPacketException,
TFTP| Modifier and Type | Field and Description |
|---|---|
(package private) int |
blockNumber
The block number being acknowledged by the packet.
|
ACKNOWLEDGEMENT, address, DATA, ERROR, MIN_PACKET_SIZE, OACK, port, READ_REQUEST, SEGMENT_SIZE, type, WRITE_REQUEST| Constructor and Description |
|---|
TFTPAckPacket(DatagramPacket datagram)
Creates an acknowledgement packet based from a received datagram.
|
TFTPAckPacket(InetAddress destination,
int port,
int blockNumber)
Creates an acknowledgment packet to be sent to a host at a given port acknowledging receipt of a block.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBlockNumber()
Gets the block number of the acknowledgement.
|
DatagramPacket |
newDatagram()
Creates a UDP datagram containing all the TFTP acknowledgement packet data in the proper format.
|
(package private) DatagramPacket |
newDatagram(DatagramPacket datagram,
byte[] data)
This is a method only available within the package for implementing efficient datagram transport by eliminating buffering.
|
void |
setBlockNumber(int blockNumber)
Sets the block number of the acknowledgement.
|
String |
toString()
For debugging
|
getAddress, getPort, getType, newTFTPPacket, setAddress, setPortTFTPAckPacket(DatagramPacket datagram) throws TFTPPacketException
datagram - The datagram containing the received acknowledgement.TFTPPacketException - If the datagram isn't a valid TFTP acknowledgement packet.public TFTPAckPacket(InetAddress destination, int port, int blockNumber)
destination - The host to which the packet is going to be sent.port - The port to which the packet is going to be sent.blockNumber - The block number being acknowledged.public int getBlockNumber()
public DatagramPacket newDatagram()
TFTPClient class. Under normal circumstances, you should
not have a need to call this method.newDatagram in class TFTPPacketDatagramPacket newDatagram(DatagramPacket datagram, byte[] data)
newDatagram in class TFTPPacketdatagram - The datagram to create.data - The buffer to store the packet and to use in the datagram.public void setBlockNumber(int blockNumber)
blockNumber - the number to setpublic String toString()
toString in class TFTPPacket