Callisto82 / tftp.net

Implements the TFTP (Trivial File Transfer) protocol (client/server) in an easy-to-use C#/.NET library.
Microsoft Public License
80 stars 38 forks source link

TftpClient does not provide a good way to add/remove options #28

Closed olijf closed 2 years ago

olijf commented 4 years ago

Certain linux servers eg: https://manpages.debian.org/testing/tftpd-hpa/tftpd.8.en.html Do not allow the usage of netascii with tsize option. Server reports error: Unsupported option(s) requested

How do I initiate a octet transfer using the tftpclient? I can not find anything in the source code examples about this. Furthermore, can I disable the options alltogether?

Callisto82 commented 4 years ago

You can propose/request various options by setting the respective properties on ITftpTransfer before calling ITftpTransfer.Start(). For example, to change the transfer mode to octet:

var transfer = client.Download("EUPL-EN.pdf");
transfer.TransferMode = TftpTransferMode.octet;

Similarily for properties like BlockSize.

olijf commented 4 years ago

Thank you for this, can this be documented somewhere? I was looking into the client object for options like that, but indeed options per transfer make more sense.

But how do I disable the options completely? So they do not end up in my request... I can set transfer size etc to zero but they still end up in the request.

image

Callisto82 commented 4 years ago

Options ending up in the request should not actually be a problem. Your server may simply ignore the whole "option negotation" mechanism. The library supports that and you just end up with TFTP defaults being used.