Click here to Skip to main content
15,885,110 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getting size of a data structure Pin
LighthouseJ5-Mar-06 4:02
LighthouseJ5-Mar-06 4:02 
GeneralRe: Getting size of a data structure Pin
S. Senthil Kumar5-Mar-06 8:12
S. Senthil Kumar5-Mar-06 8:12 
GeneralRe: Getting size of a data structure Pin
LighthouseJ5-Mar-06 8:19
LighthouseJ5-Mar-06 8:19 
QuestionFile Transfer Pin
unrealed4-Mar-06 14:30
unrealed4-Mar-06 14:30 
GeneralRe: File Transfer Pin
LighthouseJ4-Mar-06 17:16
LighthouseJ4-Mar-06 17:16 
GeneralRe: File Transfer Pin
unrealed5-Mar-06 4:14
unrealed5-Mar-06 4:14 
GeneralRe: File Transfer Pin
unrealed5-Mar-06 5:31
unrealed5-Mar-06 5:31 
GeneralRe: File Transfer Pin
LighthouseJ5-Mar-06 5:52
LighthouseJ5-Mar-06 5:52 
When I did serial communications, the hardest part was to efficiently handle the data which is what you're against, but that was in VC++ not C# but I'll take a shot in the dark.

According to the NetworkStream documentation (which I assume you are using), there's a property called DataAvailable. Why not poll that property, when it's true, read the data?

I don't know how you make sure you transmit all the bytes efficiently, but think about this:
on a client connection:
1. server -> open file, capture file length as a 64-bit (8-byte) unsigned integer
2. server -> transmit the 8-bytes, client expects the same 8 bytes
(at this point, the client knows how many bytes it'll receive)
3. client -> simply loop until the recv'd byte count matches what it's expecting
Loop these 3 steps for each file you want to send.

The most efficient communications code I've written is code that's very flexible but powerful. This includes making sure both sides are constantly at the same step in communication. In VC++, I used the timeout features of events inside of threads.

Good luck.
GeneralRe: File Transfer Pin
unrealed5-Mar-06 10:33
unrealed5-Mar-06 10:33 
Questionimporting DLL from SQL, Possible ? Pin
emran8344-Mar-06 13:39
emran8344-Mar-06 13:39 
AnswerRe: importing DLL from SQL, Possible ? Pin
Stanciu Vlad4-Mar-06 21:52
Stanciu Vlad4-Mar-06 21:52 
QuestionHow to interact with a SysTreeView in another application? Pin
luddet4-Mar-06 13:06
luddet4-Mar-06 13:06 
Questionscroll an image Pin
Susuko4-Mar-06 12:31
Susuko4-Mar-06 12:31 
AnswerRe: scroll an image Pin
AFSEKI5-Mar-06 5:01
AFSEKI5-Mar-06 5:01 
QuestionProcess List Pin
Sean894-Mar-06 12:15
Sean894-Mar-06 12:15 
AnswerRe: Process List Pin
Thomas Stockwell4-Mar-06 17:21
professionalThomas Stockwell4-Mar-06 17:21 
QuestionFrom listBox to textBox Pin
CodeItWell4-Mar-06 11:39
CodeItWell4-Mar-06 11:39 
AnswerRe: From listBox to textBox Pin
Paul Conrad4-Mar-06 12:36
professionalPaul Conrad4-Mar-06 12:36 
GeneralRe: From listBox to textBox Pin
Paul Conrad4-Mar-06 12:46
professionalPaul Conrad4-Mar-06 12:46 
QuestionDesign Time Events? Pin
cnich234-Mar-06 7:48
cnich234-Mar-06 7:48 
AnswerRe: Design Time Events? Pin
Thomas Stockwell4-Mar-06 17:16
professionalThomas Stockwell4-Mar-06 17:16 
GeneralRe: Design Time Events? Pin
cnich236-Mar-06 5:03
cnich236-Mar-06 5:03 
GeneralRe: Design Time Events? Pin
Thomas Stockwell7-Mar-06 13:26
professionalThomas Stockwell7-Mar-06 13:26 
AnswerRe: Design Time Events? Pin
Thomas Stockwell22-Mar-06 12:21
professionalThomas Stockwell22-Mar-06 12:21 
QuestionHow to slide a panel without flickering Pin
SJ_Phoenix4-Mar-06 7:48
SJ_Phoenix4-Mar-06 7:48 

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.