Chris Gilbert wrote:
It's not very efficient, as it has to read the whole file, and count the block sizes. However, this is the only way to work out the size using the tftp protocol.
Not always true; some servers send a 'tsize' option in the OACK which represents the file size in bytes.
For a reference: http://www.rfc.net/rfc2349.html specifically the "Transfer Size Option".
You can also have a look at my mtftp server implementation for more information:
http://www.invisible.ca/~jmcneill/netbsd/mtftpd-20080229.tar.gz You will want to look at specifically mtftpd.c:mtftpd_send_oack() Cheers, Jared