Can I send file on one port to more computers at the same time in C#? Like I have code to send by System.Net.Sockets on port 1234and I want to send file to 5 computers. Can I do it at the same time?
Can I send file on one port to more computers at the same time
Share
you can do that if you mean with one port the desitination port…
you will need to use
AsyncorThreadto make the sending parallel… you will have to deal with correctly setting theFileStreamsharingso the file can be opened in parallel by the different threads.see
http://msdn.microsoft.com/en-us/library/5h0z48dh.aspx
http://msdn.microsoft.com/en-us/library/system.io.fileshare.aspx
http://msdn.microsoft.com/en-us/library/system.threading.thread.aspx
http://www.csharp-examples.net/create-new-thread/
http://www.developerfusion.com/article/3918/socket-programming-in-c-part-1/2/
EDIT – as per comment :
it doesn’t make a difference… you can use
ThreadPooland create per destination one work item… see http://msdn.microsoft.com/de-de/library/system.threading.threadpool.aspx and http://www.dotnetperls.com/threadpool