如何将文件从linux复制到Windows服务器使用c [英] How to copy file from linux to windows server using c

查看:1006
本文介绍了如何将文件从linux复制到Windows服务器使用c的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须创建一个将在Linux服务器上运行的C程序。它将从Oracle数据库获取信息,创建本地文件,然后将该文件复制到Windows服务器。我知道如何在Linux服务器上创建本地文件。但是,从C复制到Windows服务器的方式是什么?

I have to create a C program which will run on Linux server. It will take information from Oracle database, create a local file and then copy that file to Windows server. I know how to create a local file on Linux server. But what is the way to copy it to windows server from C?

推荐答案

这取决于两台机器之间的连接类型以及您必须达到的安全级别。

It depends on the type of connectivty between the two machines and on the level of security you have to achieve.

最简单的情况是两台机器在同一个LAN上,没有特别的安全性。在这种情况下,可能的解决方案是:

The simplest scenario would be with the two machine on the same LAN and no particular security. In this case possible solution would be:


  • Samba :在Win机器上共享目录,在Linux机器上安装/配置Samba。

  • Samba : Share a directory on the Win machine, install/configure Samba on the Linux box. The C program will see the shared disk as a local disk under a specific path (e.g. /win/share).

NFS 的共享磁盘将作为特定路径下的本地磁盘(例如/ win / :或者,您可以使用NFS在Linux上导出目录,并在Win机器上安装/配置NFS产品。

NFS : Alternatively you can export a directory on Linux using NFS and install/configure an NFS product on the Win machine. I see this as a second option, if Samba cannot be used for any reason (e.g. security/authentication).

ftp :如果Samba由于任何原因而无法使用,您将需要在Windows机器上的ftp服务器。通过C程序复制文件也很麻烦。如果我没有误解在Linux上的ftp客户端是交互式的,它不应该用于脚本(或通过其他程序),但你应该检查。

ftp : you will need an ftp server on the Windows machine. It also will be trickier to copy the file via a C program. If I'm not mistaken the ftp client on Linux is interactive and it is not supposed to be used in a script (or via another program) but you should check.

http :您将需要在Windows计算机上的http服务器和允许上传(IIS加上一些asp页面,应该足够),并使用 libcurl 到其对话框。

http : you will need an http server on the Windows machine and a page that would allow upload (IIS plus some asp page, should suffice) and use libcurl to dialog with it.

当安全性是concerm时,更复杂的情况,需要使用scp或sftp over和SSL连接。还有libcurl与https可以提供一个足够好的解决方案。

More complicated scenario when security is a concerm, would require the use of scp or sftp over and SSL connection. Also the libcurl with https could provide a good enough solution.

我的建议是:先尝试Samba,看看是否满足您的需要,所有其他选项将需要更多的工作,您作为程序员。

My advice is: try Samba first and see if meets your need, all the other options will require more work to you as a programmer.

这篇关于如何将文件从linux复制到Windows服务器使用c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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