Windows Filesharing Library for iOS
It has been some time since my first post when I promised to myself to be more active in the iOS dev community. Well, the problem was a project that was not very fun…
For a private project I needed a simple iOS library to access a windows network share and download a file. No such free library seemed available and I did not want to dig into Samba and port it to iOS. So, I considered to write such a library myself. I was under the impression it could not be sohard to get the basic functionality I needed done.
Guess what: I was wrong! This protocol is a complete mess and over the years (new windows releases… new required features) turned into a badly documented monster (actually did not work very much time on the library, but whenever i resumed work, I got frustrated soon and called it a day). For details and if you want to get into it, here are my main resources:
- Implementing CIFS: A very good introduction to the CIFS/SMB protocol
- Common Internet File System (CIFS) Technical Reference: A try to make SMB a standard. It does not capture all of the protocols quirks, but the most common SMBs are listed and the exact format is give (when known).
- Wireshark and PacketPeeper (MacOSX)
- I actually did not have a look at it, but it might be a good reference: jCIFS: A java-based SMB-client
I can’t possibly describe you what amazing work the SAMBA guys are doing… Only a quote from the above SMB protocol introduction might give you a feeling:
Remember earlier when we talked about SMB messages as if we were dissecting some strange, new species of multi-legged critter? Well, we’ve moved beyond Entomology, Invertebrate Zoology, Taxonomy, and such. We’re now studying really complex stuff like Sociology, Psychology, and Numismatics, and we get to put the little critters into Skinner boxes and see how they react to various stimuli. It’s important research, and there are all sorts of interesting things to discover.
Enough with that. At the moment the library is tested on iOS 4.2 and with a Windows XP share. It is able to connect to a protected share and list and browse files and directories. I don’t think I will have the power to maintain the library what is beyond my exact needs (I will have to add reading and writing of files as final features), but you are free to do what you like with it. As it its a quiet small library, it might help someone get started with the protocol.
You can find the librarie’s source over at github under the BSD license: tango
Below, two screenshots from the test-app: