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 ...
随机推荐
- Ansible 快速上手
Ansible优点: 充分利用现有设施.使用 Ansible 无需安装服务端和客户端,只要 SSH 即可.这意味着,任何一台装有 Ansible 的机器都可以成为强大的管理端.我觉得,这种去中心化的思 ...
- xe8 单元别名
xe8 单元别名 Unit scope F2613 Unit 'Graphics' not found. Project>Option>Unit scope names> vcl.I ...
- 管理Entity Framework中的树结构
很多时候您需要在数据库中存储逻辑树的层次结构.这个问题有很多种实现方式,但最常见的是使用一个简单自关联的表,如下图所示 如果您映射此表与实体框架您将自动获得一个树状结构,您需将关系字段重命名,因为他们 ...
- java多线程-慎重使用volatile关键字
Java语言包含两种内在的同步机制:同步块(或方法)和 volatile 变量.这两种机制的提出都是为了实现代码线程的安全性.其中 Volatile 变量的同步性较差(但有时它更简单并且开销更低),而 ...
- 网络编程基础之粘包现象与UDP协议
一.粘包现象原理分析 1.我们先来看几行代码,从现象来分析: 测试程序分为两部分,分别是服务端和客户端 服务端.py #!/usr/bin/env python3 #-*- coding:utf-8 ...
- Scala基础:闭包、柯里化、隐式转换和隐式参数
闭包,和js中的闭包一样,返回值依赖于声明在函数外部的一个或多个变量,那么这个函数就是闭包函数. val i: Int = 20 //函数func的方法体中使用了在func外部定义的变量 那func就 ...
- 一个word小技巧
最近在进行word格式重拍的时候发现了一个有些恶心的事,怎么去匹配文档里面所有的中文呢? 后来通过网络搜索发现了答案,在word中的查找和替换中有一个选项,可以使用通配符进行匹配. 当我们使用 ([一 ...
- UNITY技巧-查找脚本被哪个场景引用
- Opencv convertScaleAbs
void cv::convertScaleAbs( cv::InputArray src, // 输入数组 cv::OutputArray dst, // 输出数组 double alpha = 1. ...
- jQuery代码在移动端不运行
今天写了个html网页发现在iOS系统上边不运行,于是真机连上Sarfari查看报错,于是乎 其实这是由于iOS的安全策略决定的,不允许加载非https的连接 报错:was not allowed t ...