类库下载

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的更多相关文章

  1. 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 ...

  2. Rancher 2:添加 NFS client provisioner 动态提供 Kubernetes 后端存储卷

    一.前提说明 1.说明: NFS client provisioner 利用 NFS Server 给 Kubernetes 作为持久存储的后端,并且动态提供PV. 默认 rancher 2 的存储类 ...

  3. NFS Server宕机后,NFS Client主机上df命令挂死

    方法1: 使用root用户:Oracle@NDMCDB05:~> su -Password: NDMCDB05:~ # cat /etc/mtab /dev/sda2 / reiserfs rw ...

  4. TCP/UDP client/server library for Java, 最好的java语言tcp udp 服务器客户端实现库

    这个库andrdoi也可以用,而且是基于类的使用方式: 它支持类似聊天室的功能,即一个人说话,所有客户端都能收到,当然也支持点点通信.它还支持 RMI 的方式调用远程过程. https://githu ...

  5. How To Configure NFS Client on CentOS 8 / RHEL 8

    https://computingforgeeks.com/configure-nfs-client-on-centos-rhel/

  6. 解决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 ...

  7. 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 ...

  8. 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 ...

  9. mysql_connect(): Headers and client library minor version mismatch.

    查询当前Client 版本,结果如下: Client API version => 5.6.31Client API library version => 5.6.31Client API ...

随机推荐

  1. 使用AdBlock plus屏蔽广告

    使用前 使用后 定制规则 使用前 添加规则 id=1的为广告

  2. 在Ubuntu 16.04如何安装Java使用apt-get的

    转自:https://www.howtoing.com/how-to-install-java-with-apt-get-on-ubuntu-16-04/ 的Java和JVM(Java的虚拟机)是广泛 ...

  3. PHP - declare tick

    今天看php手册,结构流程控制语句,翻到个没见过的关键字declare(申明的意思).于是稍稍看了下. 大概意思是:定义一段代码.关于他合适执行,怎么执行完全依照他的参数. 反正不知道什么意思.先来一 ...

  4. python 文件的读取&更新

    [python 文件的读取&更新] 任务抽象: 读取一个文件, 更新内容后, 重新写入文件. 实际应用: 磁盘上的一个配置文件, 读入内存后为一个dict, 对dict更新后重新写入磁盘. d ...

  5. 【uva1658 算法竞赛入门经典】海军上将【费用流】

    题意 给出一个v(3<=v<=1000)个点e(3<=e<=10000)条边的有向加权图,求1-v的两条不相交(除了起点和终点外没有公共点)的路径,使得权和最小. 分析 费用流 ...

  6. 71. Simplify Path (Stack)

    Given an absolute path for a file (Unix-style), simplify it. For example, path = "/home/", ...

  7. 80. Remove Duplicates from Sorted Array II (Array)

    Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For examp ...

  8. Quaternion.identity是什么意思?

    Quaternion.identity就是指Quaternion(0,0,0,0),

  9. 3-为什么很多 对 1e9+7(100000007)取模

    首先有很多题目的答案是很大的,然而出题人的本意也不是让选手写高精度或者Java,所以势必要让答案落在整型的范围内.那么怎么做到这一点呢,对一个很大的质数取模即可(自行思考为什么不是小数).那么如果您学 ...

  10. eclipse导入web项目报错 Cannot find the class file for javax.servlet.ServletContext.

    当eclipse中新导入的Java Project的时候,往往会碰到各种各样的问题,下面是个典型的问题: Cannot find the class file for javax.servlet.Se ...