So, which language I can access to a UNC share on MacOS or Linux ?
UNC with dotnet core
Hi,
I'm new with UNC with core.
Can you give some libs to work with UNC folder in core?
Thanks in advance,
Developer technologies .NET .NET Runtime
9 answers
Sort by: Most helpful
-
-
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2022-05-08T16:56:10.77+00:00 calling the SMB protocol directly rather than using the filesystem support will require you picking a SMB client library with the features you need. There are different versions of SMB (1/2/3) protocol that support different features.
https://learn.microsoft.com/en-us/windows-server/storage/file-server/file-server-smb-overview
once you find a SMB library you like, use a language it supports. typically for linux, the library will be written in C/C++. for MacOs C/C++ or objective-c
in linux, samba is main repository of code
as MacOs integrated SMB into the O/S (earlier it required installing the samba file system) , there is little support beyond SMB v1 client libraries.
there is a C# SMB v1/v2 library that may do what you need:
https://github.com/TalAloni/SMBLibrary/tree/master/SMBLibrary
note: still not sure why you want to use the SMB protocol directly rather than use file system support.
-
Dani_S 4,501 Reputation points
2022-05-08T18:49:19.713+00:00 Thanks for answer.
I need to create service for all platforms.
For windows I used worker service and use UNC and other things, using the file system support.
For Max and Linux you said to use demon services.
I have library written in C# I need to use it in Max and Linux , is it possible? I need there also UNC and file system support.
if not in which language?
Thanks in advance, -
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2022-05-09T17:13:33.873+00:00 I not sure your goals. UNC paths is windows only feature. disks and shares on windows are mapped to drive letters. UNC path, allow network access to share without mapping the share to a drive letter.
Unix uses a single file system. disks and shares are mounted into the file system, and accessed from the root. as Unix has always had loadable filesystems, the format of the disk filesystem is not know to applications. a mounted filesystem need not even have a backing store (for example pipes).
to access a network share outside the filesystem, your application needs an api to call independently of the filesystem. windows shares implement the SMB protocol which has a specification. you can write code to this specification to use a windows share outside of the filesystem. if you reach you can find projects that implement SMB, and could be used to access UNC share outside the filesystem. But why do this?
launchd is a standard launcher and monitor of unix daemons. it was developed by apple for OS/X but has become popular on several linux distros. daemons can be written in any language that supports forks and unix signals. check the docs of the distro you want to support.
launchd is replacement for the BSD init file (MacOs/Berkley unix) and service utility on linux (system 5 unix).
launchd is popular enough that Microsoft has Microsoft.Extensions.Hosting.Systemd (nuget package) that allow creating a daemon:
https://devblogs.microsoft.com/dotnet/net-core-and-systemd/
though I'm not sure its been tested on MacOs.