[
https://issues.apache.org/jira/browse/NET-604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15859470#comment-15859470
]
Sebb commented on NET-604:
--------------------------
The new version will be released when someone has time to do it.
However you can always download the source and build it yourself.
Or you can use an automated build. These are uploaded to the Apache snapshots
repo (defined in the Apache pom).
But note that these builds have not been reviewed and may not work or have bugs.
And they may be replaced at any time.
They should only be used if you understand the risks, and should never be used
in production.
> TFTP send & receive don't have progress indication
> --------------------------------------------------
>
> Key: NET-604
> URL: https://issues.apache.org/jira/browse/NET-604
> Project: Commons Net
> Issue Type: Improvement
> Components: TFTP
> Affects Versions: 3.5
> Reporter: Frank Delporte
> Labels: newbie, patch
> Fix For: 3.6
>
>
> Now there is no way to know if TFTP is progressing, so I think with a quick
> fix and two extra public variables this can be solved.
> Attached my patch for this.
> A more extended functionality with events might be better but will require
> more rework
> Index: TFTPClient.java
> ===================================================================
> --- TFTPClient.java (revision 1773211)
> +++ TFTPClient.java (working copy)
> @@ -64,6 +64,12 @@
>
> /*** The maximum number of timeouts allowed before failing. ***/
> private int __maxTimeouts;
> +
> + /*** The number of bytes received in the ongoing download. ***/
> + public int totalBytesReceived = 0;
> +
> + /*** The number of bytes sent in the ongoing upload. ***/
> + public int totalBytesSent = 0;
>
> /***
> * Creates a TFTPClient instance with a default timeout of
> DEFAULT_TIMEOUT,
> @@ -134,7 +140,7 @@
>
> beginBufferedOps();
>
> - dataLength = lastBlock = hostPort = bytesRead = 0;
> + dataLength = lastBlock = hostPort = bytesRead = totalBytesReceived =
> 0;
> block = 1;
>
> if (mode == TFTP.ASCII_MODE) {
> @@ -277,6 +283,8 @@
> ack.setBlockNumber(lastBlock);
> sent = ack;
> bytesRead += dataLength;
> +
> + totalBytesReceived += dataLength;
> } // First data packet less than 512 bytes signals end of stream.
>
> while (dataLength == TFTPPacket.SEGMENT_SIZE);
> @@ -385,7 +393,7 @@
>
> beginBufferedOps();
>
> - dataLength = lastBlock = hostPort = bytesRead = totalThisPacket = 0;
> + dataLength = lastBlock = hostPort = bytesRead = totalThisPacket =
> totalBytesSent = 0;
> block = 0;
> boolean lastAckWait = false;
>
> @@ -538,15 +546,18 @@
> /* this will be our last packet -- send, wait for ack, stop
> */
> lastAckWait = true;
> }
> +
> data.setBlockNumber(block);
> data.setData(_sendBuffer, 4, totalThisPacket);
> sent = data;
> +
> + totalBytesSent += totalThisPacket;
> }
> while ( totalThisPacket > 0 || lastAckWait );
> // Note: this was looping while dataLength == 0 || lastAckWait,
> // which was discarding the last packet if it was not full size
> // Should send the packet.
> -
> +
> endBufferedOps();
> }
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)