This entry's latest version is outdated and must be revised. Please see the documentation for the latest API.

CIFS client for NETMF by Reinhard Ostermeier

Oct. 25, 2013   |   Project   |   Licensed as Apache 2.0   |   1128 views

CIFS for NETMF is a CIFS (aka SMB) client for NETMF.
It allows to read and write files on any shared network folder, like you can share it from any Windows OS or a Linux Samba Server.

Currently unsupported CIFS Features:
- Printing (not planed)
- Pipes (not planed)
- Encrypted authetification (only plain text authtentication is supported so far, the comunity is welcome to share theire knowledge with this project)

How to use it:
1st provide credentials:
CifsClient.AddCredentials(serverIp, shareName, serverPwd, serverUser, serverDomain);
You can add different credentials for multiple Servers and multiple Shares on each Server.

Access files:
Use the CifsFile and CifsDirectory classes to access files.
These classes provides a similar Interface as the System.IO.File/Directory classes.
All path must start with "\\Server\..." (UNC path notation)
The CifsFileStream class is not really tested, so you should use the *NoStream functions.

The project contains a compete sample/test program.

This Project was originally developed on a Cobra I (EMX) with an older Firmware (4.2.8 or 9).
The final test was made with a G120+ENC28 with Firmware V4.2.11.1.

The sample Project creates an display output like:
Waiting for IP address ...

Directory Test
dir \\<serverip>\<sharename>
Name: Size: Last change:
[Folder1] dir 10/25/2013 19:28:37
SomeTextFile.txt 13 10/25/2013 19:28:53
TestFile.dat 524287 10/25/2013 20:24:45
Creating directory NewDir
NewDir found -> rename to RenamedDir
RenamedDir found -> delete it

File Test
TestFile.dat exists -> delete it
Writing random data to TestFile.dat ...
524287 Bytes written in 11.315
46336 Byte/sec.
45 kByte/sec.
Reading back TestFile.dat ...
524287 Bytes read in 10.77
48680 Byte/sec.
48 kByte/sec.
Comparing orignal and read back data (by MD5 hash)
Read back data is identical to written data

Writing orig file to SD card

Transfer file via Stream test
TestFile.dat exists -> delete it
524287 Bytes uploaded in 13.763
38094 Byte/sec.
37 kByte/sec.
Reading back TestFile.dat ...
524287 Bytes read in 11.904
44043 Byte/sec.
43 kByte/sec.
Comparing orignal and read back data (by MD5 hash)

If you have no Display you can find a file called "Results.txt" in on your shared folder after the test run.

Please be aware that the transfer rate can be significant lower if you run with an attached debugger.

Last words:
This project clearly need some refactoring and cleanup, but since there have been some requests for such a client I wanted to release it already at this state.

Comments or questions?   Discuss on the forum.

Author Version Date
Reinhard Ostermeier 1 10/25 '13 at 04:50pm