Create smb server in order to share files

*爱你&永不变心* 提交于 2019-12-06 11:53:07

问题


Most of the places online explain how to connect and read data hosted by a smb server. Wikipedia explains more about smb at:

http://en.wikipedia.org/wiki/Server_Message_Block

So what I am trying to do is to be able to open a file (located on the internet) from windows eplorer as:

I need to add this functionality to a program that I am creating. If it is to complicated to create such server I guess I will not do it but I want to try my best. I found this link which might help me do what I am looking for at: http://www.codeproject.com/Articles/309936/Csharp-NET-Network-File-System-NFS-Server But I cannot make it work.

I will appreciate very much if I can have a hello world example where I put the ip of the server on windows and it shows me a directory with the name hello world. I plan to run the server on a windows computer.

Also, it does not have to be a smb server. Any type of server that will enable me to browse for the files on windows.


回答1:


From my experience, you can't connect to a SMB share outside of your local network. If you're trying to mount a SMB share, you'll have to use a VPN or other form of tunnel adapter to connect.

But I'm a little confused by your question. Are you looking for example code for the SMB protocol or do you just want a SMB share? Look into something simple like Ubuntu with Samba. Samba is a really easy SMB share, but like I said before, it won't work over the Internet.




回答2:


There is SMBLibrary which is an open-source C# SMB 1.0/CIFS and SMB 2 Server Library.

You can implement IFileSystem and present a directory containing an "hello world" file :)

Note that Windows will only connect to servers running on port 139 or port 445, you can't specify any other port (the server:port syntax in your print-screen is invalid)

http://vm1.duckdns.org/public/SMBLibrary/SMBLibrary.htm

https://github.com/TalAloni/SMBLibrary

Tal Aloni




回答3:


Why not make it easy for yourself and setup a dropbox between the customer and the "server" that way you skip any vpn's and dont have to write any code yourself, albeit you would have to install dropbox.

Alternatively you could write your own local version of dropbox that sync files to a central repo (via any transport mechanism http(s), (s)ftp...) and then have the client run an app the sync's them with the server

EDIT: take a look at http://www.lifehacker.com.au/2011/07/how-to-set-up-a-file-syncing-dropbox-clone-you-control/



来源:https://stackoverflow.com/questions/12345233/create-smb-server-in-order-to-share-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!