How to use the NFS Client c# Library
类库下载
I add a wiki page that explains how to use the NFS Client c# .net library in your project.
NekoDrive uses a Library written in C# on .NET 2.0. that wraps the C++ NFS implementation. In order to use this library in your project download NekoDrive and copy in your project NekoDrive.NFS.dll, NFSv2.dll and NFSv3.dll. Add a reference in your project to NekoDrive.NFS.dll. Don't forget to include NFSv2.dll and NFSv3.dll as a content to deploy.
you download this library here:
http://code.google.com/p/nekodrive/
EXAMPLE 1 - CONNECT TO NFS SERVER AND GET THE EXPORTED DEVICES
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using NekoDrive.NFS;
using NekoDrive.NFS.Wrappers; namespace Example1
{
class Program
{
static void Main(string[] args)
{
using(NFS nfs = new NFS(NFS.NFSVersion.v2))
{
if (nfs.Connect(IPAddress.Parse("161.55.201.250")) == NFSResult.NFS_SUCCESS)
{
foreach(string device in nfs.GetExportedDevices())
Console.WriteLine(device);
nfs.Disconnect();
}
}
}
}
}
EXAMPLE 2 - CONNECT TO NFS SERVER, MOUNT THE FIRST EXPORTED DEVICE AND GET THE FILE LIST
namespace Example2
{
class Program
{
static void Main(string[] args)
{
using(NFS nfs = new NFS(NFS.NFSVersion.v2))
{
if (nfs.Connect(IPAddress.Parse("161.55.201.250")) == NFSResult.NFS_SUCCESS)
{
List devices = nfs.GetExportedDevices();
if(devices.Count > )
{
if(nfs.MountDevice(devices[]) == NFSResult.NFS_SUCCESS)
{
foreach(string item in nfs.GetItemList())
{
NFSAttributes attrib = nfs.GetItemAttributes(item);
Console.WriteLine(item + " " + attrib.cdateTime.ToString() + " " + attrib.size);
}
nfs.UnMountDevice();
}
}
nfs.Disconnect();
}
}
}
}
}
EXAMPLE 3 - CONNECT TO NFS SERVER, MOUNT THE FIRST EXPORTED DEVICE AND DOWNLOAD A FILE IN THE ROOT FOLDER (.)
namespace Example3
{
class Program
{
static void Main(string[] args)
{
using(NFS nfs = new NFS(NFS.NFSVersion.v2))
{
if (nfs.Connect(IPAddress.Parse("161.55.201.250")) == NFSResult.NFS_SUCCESS)
{
List devices = nfs.GetExportedDevices();
if(devices.Count > )
{
if(nfs.MountDevice(devices[]) == NFSResult.NFS_SUCCESS)
{
if(nfs.Read("test.txt", ".", @"c:\test.txt") != NFSResult.NFS_SUCCESS)
Console.WriteLine(nfs.GetLastError());
nfs.UnMountDevice();
}
}
nfs.Disconnect();
}
}
}
}
}
EXAMPLE 4 - CONNECT TO NFS SERVER, MOUNT THE FIRST EXPORTED DEVICE AND UPLOAD A FILE IN THE "TEST/SUB" SUBFOLDER
namespace Example4
{
class Program
{
static void Main(string[] args)
{
using(NFS nfs = new NFS(NFS.NFSVersion.v2))
{
if (nfs.Connect(IPAddress.Parse("161.55.201.250")) == NFSResult.NFS_SUCCESS)
{
List devices = nfs.GetExportedDevices();
if(devices.Count > )
{
if(nfs.MountDevice(devices[]) == NFSResult.NFS_SUCCESS)
{
if(nfs.Write("test.txt", "test/sub", @"c:\test.txt") != NFSResult.NFS_SUCCESS)
Console.WriteLine(nfs.GetLastError());
nfs.UnMountDevice();
}
}
nfs.Disconnect();
}
}
}
}
}
How to use the NFS Client c# Library的更多相关文章
- macOS X Mount NFS Share / Set an NFS Client
last updated November 3, 2018 in CategoriesLinux, Mac OS X, UNIX How do I access my enterprise NAS s ...
- Rancher 2:添加 NFS client provisioner 动态提供 Kubernetes 后端存储卷
一.前提说明 1.说明: NFS client provisioner 利用 NFS Server 给 Kubernetes 作为持久存储的后端,并且动态提供PV. 默认 rancher 2 的存储类 ...
- NFS Server宕机后,NFS Client主机上df命令挂死
方法1: 使用root用户:Oracle@NDMCDB05:~> su -Password: NDMCDB05:~ # cat /etc/mtab /dev/sda2 / reiserfs rw ...
- TCP/UDP client/server library for Java, 最好的java语言tcp udp 服务器客户端实现库
这个库andrdoi也可以用,而且是基于类的使用方式: 它支持类似聊天室的功能,即一个人说话,所有客户端都能收到,当然也支持点点通信.它还支持 RMI 的方式调用远程过程. https://githu ...
- How To Configure NFS Client on CentOS 8 / RHEL 8
https://computingforgeeks.com/configure-nfs-client-on-centos-rhel/
- 解决Warning: mysql_connect(): Headers and client library minor version mismatch. 警告
php -i|grep Client 查询当前Client 版本,结果如下: Client API version => 5.6.31Client API library version =&g ...
- php-mysql问题:mysqli_connect(): Headers and client library minor version mismatch. Headers:50556 Library:50637
问题现象 mysqli_connect(): Headers and client library minor version mismatch. Headers:50556 Library:5063 ...
- nginx error.log 提示 [error] 887#887: *58 FastCGI sent in stderr: "PHP message: PHP Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50556 Library:50637
0. 1.问题 1.1现象: nginx error.log 提示 [error] 887#887: *58 FastCGI sent in stderr: "PHP message: PH ...
- mysql_connect(): Headers and client library minor version mismatch.
查询当前Client 版本,结果如下: Client API version => 5.6.31Client API library version => 5.6.31Client API ...
随机推荐
- Delphi IOS MusicPlayer 锁屏运行学习
[weak] FMusicPlayer: TMusicPlayer; [weak]修饰, 编译器在处理这个变量的时候不会调用该变量内容的__ObjAddRef和__ObjRelease., proce ...
- 浅谈AVL树,红黑树,B树,B+树原理及应用(转)
出自:https://blog.csdn.net/whoamiyang/article/details/51926985 背景:这几天在看<高性能Mysql>,在看到创建高性能的索引,书上 ...
- Redis实战——安装问题汇总
借鉴:https://www.cnblogs.com/liu2-/p/6914159.html 通用方法:迅速查看缺少的包的路径,并安装 yum provides *** 如 yum provides ...
- 解决git报ssh variant 'simple' does not support setting port
解决办法 在git bash中输入命令 git config --global ssh.variant ssh
- python打开浏览器的三种方法
1.startfile方法 import os os.startfile("C:\Program Files (x86)\Google\Chrome\Application\chrome.e ...
- 使用NPM在项目中引入【lodash】
mkdir [文件名 ] 创建项目文件 mkdir lodashDemo cd [文件名] 进入项目文件 cd lodashDemo nvm -v 查看nvm版本,确定nvm已安装 nvm -v No ...
- 从零开始搭建k8s-20180301
yum install -y yum-utils git etcd yum-config-manager --add-repo https://download.docker.com/linux/ce ...
- NormalMap & CubeMap
[NormalMap & CubeMap] 有时候我们需要CubeMap的环境反射也需要有凹凸信息,此时需要装将NormalMap与CubeMap结合. 因为要使用NormalMap,使用Pr ...
- OpenGL位图函数
[OpenGL位图函数] 1.OpenGL中glBitmap用于绘制一个二值阵列. When drawn, the bitmap is positioned relative to the curre ...
- 第五章 大数据平台与技术 第13讲 NoSQL数据库
NoSQL不是不用SQL,是Not only SQL,不仅仅是结构化的查询. NoSQL兴起的原因 在Web2.0时代新浪一分钟可以发送两万条微博,苹果可以下载4.7万次应用. 数据的高并发性,同时有 ...