类库下载

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. delphi BLE 后台

    http://codeverge.com/embarcadero.delphi.ios/

  2. hibernate事务配置Aop aop:advisor模式

    <!-- 使用HibernateTransactionManager管理hibernate事务 --> <bean id="txManager" class=&q ...

  3. bps、bit、byte的区别

    bps是速度单位,bit是大小单位,byte也是大小单位1bps=1bit每秒, 8bit=1byte 1 Byte = 8    bits1 KB   = 1024 Bytes1 MB   = 10 ...

  4. proxmox 安装ROS 备忘

    虚拟机设置:使用qemu64 CPU和vrtio网卡在家里测试性能最好.

  5. SPI子系统分析之二:数据结构

    内核版本:3.9.5 spi_master struct spi_master用来描述一个SPI主控制器,我们一般不需要自己编写spi控制器驱动. /*结构体master代表一个SPI接口,或者叫一个 ...

  6. NormalMapping

    [NormalMapping] 法线贴图内的数据是法线,高度贴图内的数据是高度,不是一个东西.在ShaderLab中,UnpackNormal()分析的是法线贴图(注意不是高度贴图). 可以看到,在G ...

  7. go_常量与枚举

    package main import ( "fmt" "math" ) //常量的数值可以作为各种类型使用 func consts(){ const file ...

  8. c++ 迭代器模式(iterator)

    提供一种方法顺序访问一个聚合对象中各个元素,而又不暴露该对象的内部表示.当你需要访问一个聚集对象,而且不管这些对象是什么都需要遍 历的时候,就应该考虑用迭代器模式.同时需要对聚集有多种方式遍历时,可以 ...

  9. 由Strurts2漏洞引开谈谈web代码安全问题

    漏洞与补丁齐飞,蓝屏共死机一色. 最近struts2的安全漏洞影响面甚广,此后门为可以在url中直接远程调用脚本的漏洞和一个重定向漏洞.大家可以在s2-016远程执行脚本漏洞和s2-017重定向开放漏 ...

  10. securecrt免密码登录

    一.前言 1. 环境 客户端系统:win7 securecrt版本:6.0.2 服务端系统:centos6.5 服务端ssh实现:openssh 2. 关于认证方式 我们知道ssh一般都会提供多种客户 ...