Hi,
I'm new with UNC with core.
Can you give some libs to work with UNC folder in core?
Thanks in advance,
Hi,
I'm new with UNC with core.
Can you give some libs to work with UNC folder in core?
Thanks in advance,
the System.IO works with UNC paths
https://docs.microsoft.com/en-us/dotnet/api/system.io?view=net-6.0
Thanks for answer,
How do I connect to UNC folder with credentials using cross platform code ?
UNC paths are for windows clients only.
on MacOs and Linux, remotes are mounted to the filesystem, at any directory level you desire. to access window shares you use smb utilties and mount the share (typically with the mount cli). you can also use auto mount to only mount when in use. once mounted, the share is accessed as any folder.
on MacOs SMB support is builtin. use "Finder->Go->Connect to Server... " and use the smb: protocol (mounts to /Volumes)
smb://<servername>/<fileshare path>
you can also just use the mount cli to mount a smb volume to a mount point, or just: open "smb://<servername>/<fileshare path>" which mounts to /Volumes via finder.
on Linux, install smb file support (if not installed), and see the instruction for the distro chosen. for example on redhat:
Thanks for your answer,
Is it possible to connect to UNC folder with credentials using core library in all platforms (Mac && Linux) in C#?
No. To access a UNC share on MacOS or Linux, you need to mount the share into the file system. Once mounted, the share is accessed like any file.
So before running your program the share need mounting.
Note: you could probably find a SMB client library that your code could use.
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://docs.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.
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,
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.
7 people are following this question.
How to do encrypt and decrypt data using Cryptography API Next Generation (CNG) in C#?
What is diffrent beween CNG and Microsoft Key storage provider?
How to implement NCryptSignHash and NCryptVerifySignature in C#?
How do I configure my multithreaded .NET 6 application to use all Windows CPU groups?