Click here to Skip to main content
15,888,454 members
Home / Discussions / C#
   

C#

 
GeneralRe: A problem while transferring data over the NetworkStream Pin
SimpleData1-Jun-11 14:15
SimpleData1-Jun-11 14:15 
GeneralRe: A problem while transferring data over the NetworkStream Pin
Dave Kreskowiak1-Jun-11 14:10
mveDave Kreskowiak1-Jun-11 14:10 
GeneralRe: A problem while transferring data over the NetworkStream Pin
SimpleData1-Jun-11 14:12
SimpleData1-Jun-11 14:12 
GeneralRe: A problem while transferring data over the NetworkStream Pin
BobJanova1-Jun-11 23:11
BobJanova1-Jun-11 23:11 
GeneralRe: A problem while transferring data over the NetworkStream Pin
SimpleData2-Jun-11 0:51
SimpleData2-Jun-11 0:51 
GeneralRe: A problem while transferring data over the NetworkStream Pin
Dave Kreskowiak2-Jun-11 2:21
mveDave Kreskowiak2-Jun-11 2:21 
AnswerRe: A problem while transferring data over the NetworkStream Pin
jschell1-Jun-11 14:49
jschell1-Jun-11 14:49 
AnswerRe: A problem while transferring data over the NetworkStream Pin
Luc Pattyn1-Jun-11 14:58
sitebuilderLuc Pattyn1-Jun-11 14:58 
what you should do IMO is this:

1.
improve observability: provide logging on both sides, with actual times, and relevant data, such as offset and length.

2.
create a synthetic test file, so the receiver can predict and hence verify what should and is received. Here is one useful algorithm: for each block, start with the offset (yes, I mean stuff the offset in the data, I know you already send it as metadata), then add incrementing data modulo some number that isn't a power of 2 (for bytes, 255 works just fine). The net result is (1) each block is different (the offset!), and (2) yet very predictable. You'll see immediately if and when what gets received is completely wacked.

3.
As you have packets already in your yet extremely simple protocol, add a checksum to the protocol, so the receiver can verify things are correct. And send an ACK (when OK) or a RESEND-REQUEST (when checksum fails or something goes wrong).

4.
Refinement: don't wait for the ACK before you send the next packet; a strictly sequential process would slow things down needlessly (sender calculates checksum, sends data, waits for ACK, receiver gets data, checks checksum, sends ACK/RESEND, resulting in two periods the line isn't active at all). Instead, allow for at least 1, better a few, packets in progress, i.e. only wait for ACK for packet 1 after having send packet 1+N where N is 1 upto a few.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Please use <PRE> tags for code snippets, they improve readability.
CP Vanity has been updated to V2.3

AnswerRe: A problem while transferring data over the NetworkStream Pin
BobJanova1-Jun-11 23:10
BobJanova1-Jun-11 23:10 
GeneralRe: A problem while transferring data over the NetworkStream Pin
SimpleData2-Jun-11 0:54
SimpleData2-Jun-11 0:54 
GeneralRe: A problem while transferring data over the NetworkStream Pin
jschell2-Jun-11 9:42
jschell2-Jun-11 9:42 
GeneralRe: A problem while transferring data over the NetworkStream Pin
SimpleData2-Jun-11 10:29
SimpleData2-Jun-11 10:29 
GeneralRe: A problem while transferring data over the NetworkStream Pin
jschell6-Jun-11 8:49
jschell6-Jun-11 8:49 
GeneralRe: A problem while transferring data over the NetworkStream Pin
SimpleData6-Jun-11 9:47
SimpleData6-Jun-11 9:47 
GeneralRe: A problem while transferring data over the NetworkStream Pin
jschell7-Jun-11 9:42
jschell7-Jun-11 9:42 
QuestionSharpening the Saw Pin
eddieangel1-Jun-11 6:32
eddieangel1-Jun-11 6:32 
AnswerRe: Sharpening the Saw Pin
Luc Pattyn1-Jun-11 7:16
sitebuilderLuc Pattyn1-Jun-11 7:16 
AnswerRe: Sharpening the Saw PinPopular
SledgeHammer011-Jun-11 8:06
SledgeHammer011-Jun-11 8:06 
GeneralRe: Sharpening the Saw Pin
eddieangel1-Jun-11 8:14
eddieangel1-Jun-11 8:14 
GeneralRe: Sharpening the Saw Pin
SledgeHammer011-Jun-11 8:38
SledgeHammer011-Jun-11 8:38 
GeneralRe: Sharpening the Saw Pin
eddieangel1-Jun-11 8:42
eddieangel1-Jun-11 8:42 
GeneralRe: Sharpening the Saw Pin
SledgeHammer011-Jun-11 9:48
SledgeHammer011-Jun-11 9:48 
AnswerRe: Sharpening the Saw Pin
Luc Pattyn1-Jun-11 15:05
sitebuilderLuc Pattyn1-Jun-11 15:05 
GeneralRe: Sharpening the Saw Pin
RobCroll1-Jun-11 14:01
RobCroll1-Jun-11 14:01 
AnswerRe: Sharpening the Saw Pin
jschell1-Jun-11 8:50
jschell1-Jun-11 8:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.