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 ...
随机推荐
- Bilateral Filtering(双边滤波) for SSAO
原网址:http://blog.csdn.net/bugrunner/article/details/7170471 1. 简介 图像平滑是一个重要的操作,而且有多种成熟的算法.这里主要简单介绍一下B ...
- RocketMQ入门(简介、特点)
简介: RocketMQ作为一款纯java.分布式.队列模型的开源消息中间件,支持事务消息.顺序消息.批量消息.定时消息.消息回溯等. 发展历程: 1. Metaq(Metamorphosis) 1. ...
- poi操作word 2007 常用方法总结
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io ...
- c3p0、dbcp和proxool比较
现在常用的开源数据连接池主要有c3p0.dbcp和proxool三种,其中: hibernate开发组推荐使用c3p0; spring开发组推荐使用dbcp(dbcp连接池有weblogic连接池同样 ...
- bash's parameter expansion
[bash's parameter expansion] #: find first from left, remove-left ##: find last from left, remove le ...
- 阿里云 mysql 远程登录权限
[mysql中配置] 授权法: 1.登录到mysql中,为root进行远程访问的授权,执行下面的命令: mysql> GRANT ALL PRIVILEGES ON *.* TO root@& ...
- mysql的my.ini配置文件
第一步,我们找到mysql安装文件下面的my.ini文件,打开可以看到第一句: # MySQL Server Instance Configuration File Mysql服务实例配置文件 好,咱 ...
- 搭建Spring开发环境并编写第一个Spring小程序
搭建Spring开发环境并编写第一个Spring小程序 2015-05-27 0个评论 来源:茕夜 收藏 我要投稿 一.前面,我写了一篇Spring框架的基础知识文章,里面没 ...
- 函数用途:同一域名对应多个IP时,获取指定服务器的远程网页内容
<?php /************************ * 函数用途:同一域名对应多个IP时,获取指定服务器的远程网页内容 * 创建时间:2008-12-09 * 创建人:张宴(img. ...
- arping
强制交换机刷新MAC arping -I em2(网卡名称) 58.215.88.8(Vip)