使用C#从Windows计算机从Linux计算机读取文件 [英] Read file from linux computer from windows computer with c#

查看:117
本文介绍了使用C#从Windows计算机从Linux计算机读取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要使用c#从Windows计算机中的linux计算机中读取文件.

Hello all,

I need to read file from linux computer from windows computer with c#.

Would you please guide me right way.

推荐答案

在Linux上,您可以选择几种不同的FTP服务器.每台服务器都提供了自己的方式来配置对服务器文件系统某些部分的匿名访问.通常,FTP服务器基于每个用户提供对服务器文件系统上不同目录的访问,匿名用户可以被视为用户之一.您需要搜索Linux或Unix FTP服务器,并了解每个服务器的功能.

可以基于类System.Net.FtpWebRequest将C#代码用作FTP客户端;您将在此处找到一些代码示例: http://msdn.microsoft.com/zh-我们/library/system.net.ftpwebrequest.aspx [ ^ ].

一种完全不同的方法是在Linux上安装Mono,并开发一些具有文件共享功能的自定义应用程序.如果是CLR,Mono是跨平台的实现,它与.NET的兼容性非常好.我用它来解决跨平台应用程序中最棘手的问题.请参见 http://en.wikipedia.org/wiki/Mono_%28software%29 [ ^ ],http://www.mono-project.com/ [ ^ ].在Windows上开发的代码可以在Linux和其他平台(甚至是最棘手的Mac OS X)上的Mono下运行,而无需重新编译.

—SA
On Linux, you have a choice of several different FTP servers; each of the servers providing its own ways to configure anonymous access to some part of the server''s file system. Usually, FTP servers provide access to different directories on server''s file system on per-user basis, and the anonymous user can be treated as one of the users. You need to perform the search for Linux or Unix FTP servers and learn about features of each.

Using C# code as a FTP client can be based on the class System.Net.FtpWebRequest; you will find some code samples here: http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx[^].

One completely different approach could be installing Mono on Linux and developing some custom application with file sharing. Mono is cross-platform implementation if CLR, its compatibility with .NET is wonderful. I use it for solving most tricky problems of cross-platform applications. See http://en.wikipedia.org/wiki/Mono_%28software%29[^], http://www.mono-project.com/[^]. The code developed on Windows can be run under Mono on Linux and other platforms (even most tricky Mac OS X) without recompilation.

—SA


这篇关于使用C#从Windows计算机从Linux计算机读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆