Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, August 28, 2013 2:48 PM
Hi,
we are using below code to transfer files from one machine to another. We want to know that by default which protocol is used to transfer files ? Is it CIFS ?
System.IO;
DirectoryInfo dir = new DirectoryInfo(sourceDirName);
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
string temppath = Path.Combine(destDirName, file.Name);
file.CopyTo(temppath, false);
}
All replies (5)
Wednesday, September 4, 2013 8:02 AM ✅Answered
1) System.IO.File.Copy uses the CopyFile method in kernel32.dll, and this method uses the CIFS/SMB protocol when copy files through network shared folder.
2)File.Copy is indeed what you want. But I think the better way is to send file through FTP.
http://msdn.microsoft.com/en-us/library/ms229715.aspx
Caillen
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
Thursday, August 29, 2013 9:53 AM
Please check this thread:
http://stackoverflow.com/questions/2410572/file-copy-function
It uses the native Win32 method CopyFile in kernel32.dll. Files are copied over the normal file system or over SMB (which was correctly pointed out to use TCP by mjmarsh).
More information could be found here:
http://www.samba.org/cifs/docs/what-is-smb.html
Caillen
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
Monday, September 2, 2013 11:21 AM
We can say that SAMBA and CIFS protocol are same but as per above code, Can I say that CIFS protocol is used in the code ?
Tuesday, September 3, 2013 7:42 AM
Yes, they're the same.
And CIFS is actually based on TCP-NETBIOS, generally the port is 139 or 445.
For more information, please refer to this link:
http://msdn.microsoft.com/en-us/library/ee441901%28v=prot.20%29.aspx
Caillen
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.
Wednesday, September 4, 2013 7:25 AM
I am fully confused now.
1) System.IO class uses CIFS/SMB protocol ?
2) I want C# code that should use the CIFS/SMB protocol to send files(upload/download) from one machine to another.
Please provide me answer of above asked queries.