SynappzMA/TOSMBClient

Name: TOSMBClient

Owner: Synappz Medical Apps

Description: An Objective-C binding around the libDSM SMB client library.

Forked from: TimOliver/TOSMBClient

Created: 2018-01-15 08:55:52.0

Updated: 2018-01-15 08:55:54.0

Pushed: 2018-01-15 11:43:19.0

Homepage:

Size: 6898

Language: Objective-C

GitHub Committers

UserMost Recent Commit# Commits
Tim Oliver2018-01-05 04:07:58.093
Natalia2016-08-22 13:37:02.07
wojtkow2016-05-24 17:12:28.01
rajderks2017-12-11 11:06:24.01

Other Committers

UserEmailMost Recent Commit# Commits
Roy Derks2018-01-15 11:43:13.01
daoquandaoquan.lu@feixun.com.cn2017-03-21 10:09:30.01
akaltanifirstlast@108.61.41.58.choopa.net2016-08-17 21:20:58.01
RedBugmiguelvanhove@shiva.local2018-01-04 10:55:27.01
Nicholas Spencernspencer@shyp.com2016-11-18 06:18:08.021
???toshima@abt.jp2016-06-01 07:28:23.01

README

TOSMBClient

Beerpay PayPal

TOSMBClient is a small library that serves as a simple SMB (Server Message Block ) client for iOS apps. The library allows connecting to SMB devices, downloading file metadata, and subsequently allows asynchronous downloading of files from an SMB device straight to an iOS device.

It is an Objective-C wrapper around Defective SMb, or libDSM, a low level SMB client library built in C built by some of VideoLabs' developers. A copy of libDSM has been specially cross-compiled for iOS device architectures and embedded in this library, so this project has no external dependencies.

Features
Examples
Create a new Session
ort "TOSMBClient.h"

BSession *session = [[TOSMBSession alloc] initWithHostName:@"Tims-NAS" ipAddress:@"192.168.1.3"];
sion setLoginCredentialsWithUserName:@"wagstaff" password:@"swordfish"];

Ideally, it is best to supply both the host name and IP address when creating a new session object. However, if you only initially know one of these values, TOSMBSession will perform a lookup via NetBIOS to try and resolve the other value.

Request a List of Files from the SMB Device
synchronous Request
sion requestContentsOfDirectoryAtFilePath:@"/"
success:^(NSArray *files){ 
  NSLog(@"SMB Client Files: %@", error.localizedDescription);
}
error:^(NSError *error) {
    NSLog(@"SMB Client Error: %@", error.localizedDescription);
}];

ynchronous Request
ray *files = [session requestContentsOfDirectoryAtFilePath:@"/" error:nil];

All request methods have a synchronous and an asynchronous implementation. Both return an NSArray of TOSMBSessionFile objects that provide metadata on each file entry discovered.

Downloading a File from an SMB Device
BSessionDownloadTask *downloadTask = [session downloadTaskForFileAtPath:@"/Comics/Issue-1.cbz"
  destinationPath:nil //Default is 'Documents' directory
  progressHandler:^(uint64_t totalBytesWritten, uint64_t totalBytesExpected) { NSLog(@"%f", (CGFloat)totalBytesWritten / (CGFloat) totalBytesExpected);
  completionHandler:^(NSString *filePath) { NSLog(@"File was downloaded to %@!", filePath); }
  failHandler:^(NSError *error) { NSLog(@"Error: %@", error.localizedDescription); }];

nloadTask resume];

Download tasks are handled similarily to their counterparts in NSURLSession. They may paused or canceled at anytime (Both however reset the connection to ensure nothing hangs), and they additionally implement the UIApplication backgrounding system to ensure downloads can continue, even if the user clicks the Home button.

Technical Requirements

iOS 7.0 or above.

License

Depending on which license you are using for libDSM, TOSMBClient is available in multiple licenses.

For the LGPL v2.1 licensed version of libDSM, TOSMBClient is also available under the same license. For the commercially licensed version of Defective SMb, TOSMBClient is available under the MIT license. analytics


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.