NSURLProtocol Subclass to Support TFTP

6 views
Skip to first unread message

Chris Larsen

unread,
Jun 7, 2019, 11:33:37 AM6/7/19
to cocoaheads---...@googlegroups.com
Sorry I have missed the last few meetings. I’ve been taking a Verilog class on Thursday nights. Last class is next week so I’m hoping to attend this month.

As far as I can tell Apple doesn’t have native support for TFTP but it is possible to subclass NSURLProtocol and add support for any URL type.

Do any of you know about such a package which I could download?

Thanks,

Chris

David Phillip Oster

unread,
Jun 19, 2019, 2:08:47 PM6/19/19
to CocoaHeads - Silicon Valley
What are you really trying to do?

The easiest tack is to write an app, iOS or macOS, that registers 'tftp' as a scheme that it handles. Then, when the user clicks on a tftp://host.tld/exampleFile.txt URL, your app would get called to download the file, storing it in its Documents directory, and giving a directory listing as its U.I.

Once that is working, you'd use NSURLProtocol to claim the tftp scheme, show the user a WKWebView, and when the user taps on a tftp://host.tld/exampleFile.txt URL you fetch the file and just return the NSData up to the WKWebView.

You can look for any open source TFTP package that implements the underlying UDP fetching using BSD networking calls, and that will work on iOS or macOS.

(Sorry for the slow reply - I didn't see your post in my email.)
Reply all
Reply to author
Forward
0 new messages