3

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:

enter image description here

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
  • I think you will be able to find quite a lot of material about HTTP servers if you were to go looking. Of course, if you need authorized write access, the situation is a bit more complex.
    – tripleee
    Commented Sep 10, 2012 at 4:23

3 Answers 3

4

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

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.

5
  • I need it to work over the internet :( . I am creating a custom program for a customer and he wants to be able to open files on the share from windows. For example if he saves his outlook database file on there it will be nice to access it without having it to download and update it... Maybe he has a lot of files and he is tired of connecting to the slow vpn
    – Tono Nam
    Commented Sep 10, 2012 at 4:40
  • any code you write is going to be just a slow, you might be able to get them to open up the smb ports but thats a bad bad bad idea Commented Sep 10, 2012 at 4:56
  • 1
    @TonoNam Maybe you should consider webDav instead of a SMB share
    – Seph
    Commented Oct 24, 2012 at 12:40
  • 1
    Today you can have internet shares, Azure even provides such service over internet, no vpn required.
    – Felype
    Commented Oct 5, 2017 at 17:46
  • The answer is incorrect, I'm using SMB 1.0 / 2.0 over the internet on a daily basis, no VPN.
    – Tal Aloni
    Commented Mar 29, 2018 at 16:12
-1

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/

2
  • Dropbox does not support more than I dont remember how much of data. The user wants to place 500 gb of back up on two computers and then from that point on start synchronizing.
    – Tono Nam
    Commented Sep 10, 2012 at 5:16
  • there are paid versions of dropbox that would support this Commented Sep 10, 2012 at 5:38

Not the answer you're looking for? Browse other questions tagged or ask your own question.