I’m tinkering on a GHI 20260d board, writing code using VS on windows. The board is connected to my LAN via ethernet and has been working just fine.
I have an SD card attached as well, but I also have a shared drive on my local network.
So cut to, I was wondering if TinyCLR OS has any pre-built or useful libraries or any capability that would allow me to both store and access files from a shared network drive, rather than have to store everything on the SD card. How would you suggest approaching the code on something like that?
Also, out of curiosity, can TinyCLR OS host a shared network drive? I’m not super familiar with how one operates, but I imagine its similar to hosting a web server?
There is no built in file sharing but this is something that can be built using the available TCP/IP stack (sockets). An easier option is to build your own simple protocol to cover your on needs vs building one full blown protocol. We do have some an unsupported FTP stack (if I remember correctly) that you can start with.
Alrighty, thanks for the response! I’m pretty to new to microcontrollers; is the file transfer protocol specific to TCP/IP or is it similar to a file stream? When you say you have an unsupported FTP stack, what does that imply and how would I find it?
Ultimately my goal is transfer a file from the SD card to my existing network drive, but I don’t know how to connect to it nor how to push/pull data. So far I’ve only been able to download a file from an arbitrary web server using the HttpWebRequest class. Is there any class similar to this that would be useful for connecting to a network drive?
I’d suggest you abandon what you’re thinking right now…
OK that may be a bit too harsh first up, but to be frank, you’re on a security hiding to nowhere trying to use the “network drive” concept. If you wanted to use, for example, a CIFS shared file location, you’d need to have saved credentials or you’d need to have the CIFS share work for anonymous use, PLUS you would have to have a CIFS client on your local microcontroller location (which would be a significant challenge in itself - and nobody really has provided a solution at this time, again I suspect the security aspect here makes it unpalatable to make this commercially)
I’d stick with your http/s and develop a way to upload content and access it that way. web based protocols and methodologies are likely to have less complexity than “client” based methods.
Is there any class similar to this that would be useful for connecting to a network drive?
You’re going need some sort of backend application running serverside to get your files and package the filestream into an HTTP payload, or accept the binary payload and write the file to the drive.
I’ve had some success with this playing around with it at home, but I’m far from an expert - I was able to create a basic API to transfer an STL file back and forth, but that’s about it. When I have more time to get back to it I’ll mess around with it more. I use the HTTPWebRequest class on the client and my server application is just a C# console app with an HttpListener - You’ll basically be uploading and downloading files from a server.
If you’re hoping that there’s something where you can connect to a network drive and just use it like the USB or SD File system, to my knowledge, there isn’t anything like that available.
Alright so boss man asked me to come back to this problem so here I am. I’ve found the C# DirectoryInfo class can normally let you access an existing network drive just by typing in the network path:
DirectoryInfo publicDrive = new DirectoryInfo(@“\\MY-PC-NAME\Users\Default.…”);
. . . return true;
However, unlike the examples online, the GHI can’t seem to find the path, always returning false. I have confirmed the drive exists by accessing it without any credentials from other computers. I’ve also tried replacing “MY-PC-NAME” with the local IP address but that didn’t work either.
I would appreciate any help on how to proceed here. Thanks!