Click here to Skip to main content
15,910,358 members
Home / Discussions / C#
   

C#

 
QuestionConfig file in dll project? Pin
davebarkshire27-May-05 1:08
davebarkshire27-May-05 1:08 
AnswerRe: Config file in dll project? Pin
DavidNohejl27-May-05 2:31
DavidNohejl27-May-05 2:31 
AnswerRe: Config file in dll project? Pin
Dave Kreskowiak27-May-05 2:33
mveDave Kreskowiak27-May-05 2:33 
GeneralSmall UI prob Pin
Niklas Ulvinge27-May-05 0:56
Niklas Ulvinge27-May-05 0:56 
GeneralRe: Small UI prob Pin
John Fisher27-May-05 4:37
John Fisher27-May-05 4:37 
GeneralRe: Small UI prob Pin
Niklas Ulvinge27-May-05 4:47
Niklas Ulvinge27-May-05 4:47 
GeneralRe: Small UI prob Pin
John Fisher27-May-05 6:16
John Fisher27-May-05 6:16 
GeneralRe: Small UI prob Pin
Niklas Ulvinge27-May-05 6:23
Niklas Ulvinge27-May-05 6:23 
GeneralRe: Small UI prob Pin
John Fisher27-May-05 6:36
John Fisher27-May-05 6:36 
GeneralRe: Small UI prob Pin
Niklas Ulvinge27-May-05 6:40
Niklas Ulvinge27-May-05 6:40 
GeneralRe: Small UI prob Pin
John Fisher27-May-05 10:44
John Fisher27-May-05 10:44 
GeneralStatic class Pin
LIUCKAS27-May-05 0:01
LIUCKAS27-May-05 0:01 
GeneralRe: Static class Pin
User 665827-May-05 0:37
User 665827-May-05 0:37 
GeneralRe: Static class Pin
Andrew Kirillov27-May-05 0:37
Andrew Kirillov27-May-05 0:37 
GeneralRe: Static class Pin
Niklas Ulvinge27-May-05 0:48
Niklas Ulvinge27-May-05 0:48 
GeneralRe: Static class Pin
Robert Rohde27-May-05 5:21
Robert Rohde27-May-05 5:21 
GeneralRe: Static class Pin
Niklas Ulvinge27-May-05 6:19
Niklas Ulvinge27-May-05 6:19 
GeneralRe: Static class Pin
Wraith227-May-05 0:51
Wraith227-May-05 0:51 
GeneralRe: Static class Pin
LIUCKAS29-May-05 20:40
LIUCKAS29-May-05 20:40 
GeneralFileSystemWatcher Pin
s2111979226-May-05 23:53
s2111979226-May-05 23:53 
GeneralRe: FileSystemWatcher Pin
John Fisher27-May-05 4:43
John Fisher27-May-05 4:43 
GeneralClient socket sometimes splits data Pin
Darth.Vader26-May-05 23:48
Darth.Vader26-May-05 23:48 
GeneralRe: Client socket sometimes splits data Pin
John Fisher27-May-05 4:50
John Fisher27-May-05 4:50 
This happens for valid reasons within normal operation, so you should just concentrate on how to deal with the result (not really a mutilation, just a separation as it travels over the network).

Your protocol must somehow indicate the beginning and end of a message. One simple way is to always end a message with a unique byte signature of some kind. Another way is to begin every message with a set number of bytes (say 4) that indicates the byte length of the rest of the message.

After you have established a way to know the beginning and end of the message, you edit your receive code to notice the difference, and to process a whole message at a time. (Merge split message chunks into one byte array if needed.)

Another thing you should watch out for, is a common scenario like this:

Server sends data: 1500 bytes
Server sends data: 2100 bytes
Server sends data: 1400 bytes
Client receives data: 5000 bytes

In that case, you will also need to know the beginning and end of a message, so you can process the messages individually from the received data.

John

"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.

GeneralRe: Client socket sometimes splits data Pin
Darth.Vader27-May-05 5:33
Darth.Vader27-May-05 5:33 
GeneralRe: Client socket sometimes splits data Pin
John Fisher27-May-05 10:46
John Fisher27-May-05 10:46 

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.