Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to 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 26-Jan-13 19:47pm
yatharthz1.1K
Edited 26-Jan-13 19:50pm
v2
Comments
Sergey Alexandrovich Kryukov at 27-Jan-13 1:10am
   
Why UDP? It's not really good for sending files, but TCP is just right.
—SA

1 solution

Rate this: bad
good
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:
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
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 7,105
1 DamithSL 5,079
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,617
4 Kornfeld Eliyahu Peter 4,384


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2014
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