Click here to Skip to main content
12,884,951 members (29,171 online)
Rate this:
Please Sign up or sign in to vote.
See more: (untagged)

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 26-Jan-13 18:47pm
Updated 26-Jan-13 18:50pm
Why UDP? It's not really good for sending files, but TCP is just right.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:[^].

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.[^].


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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100