Click here to Skip to main content
15,887,676 members
Home / Discussions / C#
   

C#

 
GeneralMessage Removed Pin
16-Sep-11 5:29
professionalN_tro_P16-Sep-11 5:29 
GeneralRe: Bitmaps Pin
Dave Kreskowiak16-Sep-11 12:08
mveDave Kreskowiak16-Sep-11 12:08 
AnswerRe: Bitmaps Pin
MicroVirus15-Sep-11 4:06
MicroVirus15-Sep-11 4:06 
GeneralRe: Bitmaps Pin
Dave Kreskowiak15-Sep-11 9:32
mveDave Kreskowiak15-Sep-11 9:32 
QuestionSerialPort class DataReceived event question Pin
Ken Booth14-Sep-11 11:38
Ken Booth14-Sep-11 11:38 
AnswerRe: SerialPort class DataReceived event question Pin
Richard Andrew x6414-Sep-11 12:04
professionalRichard Andrew x6414-Sep-11 12:04 
GeneralRe: SerialPort class DataReceived event question Pin
Ken Booth14-Sep-11 12:23
Ken Booth14-Sep-11 12:23 
AnswerRe: SerialPort class DataReceived event question Pin
Luc Pattyn14-Sep-11 16:25
sitebuilderLuc Pattyn14-Sep-11 16:25 
I am not surprised, asynchronous receive is a complex process, there are several actors, and some buffers with their sizes and thresholds, some of which one cannot control at all.

You should not be lazy and refuse to loop over the bytes you get in one go, that is pretty easy to accomplish.

It gets really nasty when you have to implement a message-oriented protocol, where the sender sends two or more messages back-to-back, and your receiver unfortunately receives three or more DataReceived events, each covering an arbitrary part of the messages sent (say first half of first msg, then second half+first half of second msg, finally second half of second message).

The only serial receive that goes smoothly is the one that has a fixed message separator (say a NEWLINE) which is guaranteed to appear in between messages and never inside a message (in that case set the NewLine property and use ReadLine). If that is not the case, get ready to collect what you get, whatever amount comes in, then re-packetize it according to your needs.

And then, you should carefully consider whether you need some recovery mechanism, something that helps you out in case some character gets damaged or lost...

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: SerialPort class DataReceived event question Pin
Ken Booth14-Sep-11 20:21
Ken Booth14-Sep-11 20:21 
QuestionHow do I change the connection string for Database Designer-designed objects? Pin
Interrobang14-Sep-11 7:52
Interrobang14-Sep-11 7:52 
AnswerRe: How do I change the connection string for Database Designer-designed objects? Pin
Mycroft Holmes14-Sep-11 14:35
professionalMycroft Holmes14-Sep-11 14:35 
AnswerRe: How do I change the connection string for Database Designer-designed objects? Pin
PIEBALDconsult14-Sep-11 15:11
mvePIEBALDconsult14-Sep-11 15:11 
QuestionAxWindowsMediaPlayer Pin
Francesco-8014-Sep-11 7:08
Francesco-8014-Sep-11 7:08 
AnswerRe: AxWindowsMediaPlayer Pin
Francesco-8015-Sep-11 1:18
Francesco-8015-Sep-11 1:18 
Questionwhat is the "game engine"???? Pin
gif202013-Sep-11 23:40
gif202013-Sep-11 23:40 
AnswerRe: what is the "game engine"???? Pin
Pete O'Hanlon13-Sep-11 23:52
mvePete O'Hanlon13-Sep-11 23:52 
GeneralRe: what is the "game engine"???? Pin
OriginalGriff14-Sep-11 3:10
mveOriginalGriff14-Sep-11 3:10 
GeneralRe: what is the "game engine"???? Pin
molesworth14-Sep-11 7:27
molesworth14-Sep-11 7:27 
QuestionGetThreadPreferredUILanguages Pin
marca29213-Sep-11 22:56
marca29213-Sep-11 22:56 
AnswerRe: GetThreadPreferredUILanguages Pin
Luc Pattyn14-Sep-11 1:52
sitebuilderLuc Pattyn14-Sep-11 1:52 
AnswerRe: GetThreadPreferredUILanguages Pin
BobJanova14-Sep-11 2:14
BobJanova14-Sep-11 2:14 
QuestionWhere to use Try/Catch block? [modified] Pin
Adam_Dev13-Sep-11 22:21
Adam_Dev13-Sep-11 22:21 
AnswerRe: Where to use Try/Catch block? Pin
BobJanova13-Sep-11 22:40
BobJanova13-Sep-11 22:40 
GeneralRe: Where to use Try/Catch block? [modified] Pin
Adam_Dev13-Sep-11 23:01
Adam_Dev13-Sep-11 23:01 
GeneralRe: Where to use Try/Catch block? Pin
BobJanova14-Sep-11 2:09
BobJanova14-Sep-11 2:09 

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.