1

I want to develop an application that can reads contents from a folder shared on a Windows Desktop.

I've found that there is a Samba implementation to share iOS folders to windows, but I've found yet what I'm looking for.

How can I read windows shared folders from my iOS device programatically?

There is a protocol called SMB to share folders on Windows, isn't it? Is there an implementation of that protocol on iOS SDK?

VansFannel
  • 45,055
  • 107
  • 359
  • 626

1 Answers1

0

In Xamarin.iOS (iOS app dev env on C#), the free library "SharpCifs.Std" exists.

For file reading, use it like this:

var file = new SmbFile("smb://UserName:Password@ServerName/ShareName/Folder/FileName.txt"));
var readStream = file.GetInputStream();
var buffer = new byte[1024*8];
var memStream = new MemoryStream();
int size;
while ((size = readStream.Read(buffer, 0, buffer.Length)) > 0)
    memStream.Write(buffer, 0, size);

Console.WriteLine(Encoding.UTF8.GetString(memStream.ToArray()));

I need to write in C# rather than Obj-C/Swift, but I think that you can make use of your knowledge of Obj-C/Swift abundantly.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
ume05rw
  • 11
  • 2