Function File.Copy ()

Does anyone know how the File.Copy () function is implemented? I need to know if the file was copied using a TCP connection.

Thank you, Haviva.

+4
source share
3 answers

It uses the native CopyFile Win32 method in the kernel32.dll file. Files are copied through a regular file system or SMB (which was correctly indicated for using TCP via mjmarsh).

Or, as Scott Dorman correctly adds, he can use the CreateFile method also in kernel32.dll.

+5
source

It is on a deeper level than this. File.Copy will call the Windows API to execute the copy. If you encounter TCP as the main protocol of your network stack, it will use TCP. If Windows decides to use a different protocol, it will use this option instead. Therefore, if your network configuration sets Banyan VINES as your default protocol and you disable TCP ;-), File.Copy will not use TCP.

+2
source

Source: https://habr.com/ru/post/1303571/


All Articles