Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: (untagged)
Hi,

I am trying to built a C# windows application which will transfer file line by line by selecting TCP or UDP (both should be on same windows app) and the line transferred should be displayed in a text box1 followed by line received at another text box2... on same windows but didn't succeed can any1 send me sample code...
Posted
Updated 26-Jan-13 18:50pm
v2
Comments
Sergey Alexandrovich Kryukov 27-Jan-13 1:10am    
Why UDP? It's not really good for sending files, but TCP is just right.
—SA

1 solution

Sorry, we don't send codes, and we don't develop applications on your orders. This is a Questions & Answers forum, did you notice it?

First of all, not all files consist of lines. And even for the files consisting of lines, line be line is just a bad idea. Usually, it is done by some blocks of reasonable equal size (except perhaps a last one).

It also cannot be just one application. As you work with two different computers, there are always two applications, one on each side. But of course, you may want to have only one application just because on other side the application can be some Windows service which is already available. In particular, it can use file sharing protocol, FTP or HTTP (I did not mentions also secure versions of these protocols). They are all application level protocols ([^]).

On the other side, the use of file sharing is just a file copy. Basically, the classes you can use are derived from the class System.Net.WebRequest. Please see:
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx[^].

And, finally, you can use your own, custom application-level protocol. In this case, the applications on both sides are on you. It can even be one generalized application, but you have to have it on both sides. You can work at different layers of networking from raw sockets (but do yourself a bit favor: UDP, not TCP), to "classical" .NET remoting to WCF. I tried to overview it in my past answers:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900