TFTP Server Class

Hey all,

I need to implement a TFTP server in one of my apps. I am wanting to not re-invent the wheel. I did some searching and found:

http://wmsi.co/shop/services/2-products/xc-001/P18-xojo-tftp.html

Anyone know about this product? Anyone else have code they’d be willing to share?

Thanks,

Jon

Never heard of this before. Looks cheap enough to try it though.

Well, I found on the site where you could download a demo. It isn’t a server. It’s a client with upload and download capabilities. I tried contacting the author but no response.

But…

Upon further research, I have found that OS X includes a TFTP server that can easily be enabled/disabled by a few shell commands. So that was a big “easy” button. Windows does not include it but I did find a free program that at least according to the license appears that I can distribute it with my code. And I can have it run in background mode hidden. I’ve tried contacting the author of the Windows app to verify I can distribute it but he has not responded.

That would be excellent if you wrote a TFTP server in Xojo :slight_smile: :slight_smile:

It would be. However, on the Mac side at least, you really don’t need to/can’t. TFTP uses UDP on port 69. In OS X, the built in TFTP server is basically assigned that. And so why re-invent the wheel there. I am sure Linux has a native TFTP server you could access as well.

On Windows, there’s certainly room to write. From what I could tell there’s only 3 or 4 different FTP server packages out there, the most popular probably being Solar Winds. But I found TFTPD . It is free and looks to have an open license and the author provides the source code. But I am not proficient and being able to convert/decipher C from Windows into a Xojo project.

His stuff does 90% of what I want it to do and I think I can use it. It doesn’t have a command line mode where you can pass parameters. So I’ll have to edit the .ini file in Xojo code before launching the app in a shell. It runs in “hidden” mode but it does briefly flash open before being hidden. That’s a bummer too. And lastly, I’ve not figured out yet how to quit an app that has been started from a shell in Xojo.

To actually write the server code is probably beyond what I want to do right now. Once you know the protocol fully, I don’t really think it would be that hard - it basically consists of listening on port 69 on a UDP socket. Once you get the request to send the file, you send it in 512 byte chunks. It’s the actual protocol commands that one needs to read-up on and learn.

[quote=143388:@Jon Ogden]It would be. However, on the Mac side at least, you really don’t need to/can’t. TFTP uses UDP on port 69. In OS X, the built in TFTP server is basically assigned that. And so why re-invent the wheel there. I am sure Linux has a native TFTP server you could access as well.

On Windows, there’s certainly room to write. From what I could tell there’s only 3 or 4 different FTP server packages out there, the most popular probably being Solar Winds. But I found TFTPD . It is free and looks to have an open license and the author provides the source code. But I am not proficient and being able to convert/decipher C from Windows into a Xojo project.

His stuff does 90% of what I want it to do and I think I can use it. It doesn’t have a command line mode where you can pass parameters. So I’ll have to edit the .ini file in Xojo code before launching the app in a shell. It runs in “hidden” mode but it does briefly flash open before being hidden. That’s a bummer too. And lastly, I’ve not figured out yet how to quit an app that has been started from a shell in Xojo.

To actually write the server code is probably beyond what I want to do right now. Once you know the protocol fully, I don’t really think it would be that hard - it basically consists of listening on port 69 on a UDP socket. Once you get the request to send the file, you send it in 512 byte chunks. It’s the actual protocol commands that one needs to read-up on and learn.[/quote]

Haha awesome response Jon as you certainly have spent time on this. I was half kidding in my reply :slight_smile:

Implementing any RFC based protocol is never trivial :wink: Thanks for revising this topic as this is great information.

Thanks!