开发者

File.Copy() function

Does an开发者_运维知识库yone know how the function File.Copy() is implemented? I need to know if the file is copied using TCP connection.

Thanks, Haviva.


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).

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


It's at a deeper level than that. File.Copy will call the Windows API to perform the copy. If you happen to have TCP as your primary protocol on your machine's network stack, it will use TCP. If Windows decides to use another protocol, it will use that one instead. So if your network configuration sets Banyan VINES as your default protocol and you have disabled TCP ;-), File.Copy won't use TCP.


If you're wondering about TCP I'm assuming you are talking about copying to a network share.

Check out these links for info on what protocols/ports are used:

http://www.chicagotech.net/netforums/viewtopic.php?t=5067

http://support.microsoft.com/kb/832017

http://maximumpcguides.com/windows-vista/windows-vista-file-and-printer-sharing-ports/http://maximumpcguides.com/windows-vista/windows-vista-file-and-printer-sharing-ports/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜