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

C#

 
GeneralRe: Cross post Pin
scorpio222-Feb-10 1:33
scorpio222-Feb-10 1:33 
GeneralRe: Cross post Pin
Not Active2-Feb-10 1:56
mentorNot Active2-Feb-10 1:56 
GeneralRe: Cross post Pin
scorpio222-Feb-10 2:55
scorpio222-Feb-10 2:55 
QuestionOpen Source Project Pin
programmervb.netc++1-Feb-10 13:06
programmervb.netc++1-Feb-10 13:06 
AnswerRe: Open Source Project Pin
April Fans2-Feb-10 20:18
April Fans2-Feb-10 20:18 
GeneralRe: Open Source Project Pin
programmervb.netc++3-Feb-10 16:17
programmervb.netc++3-Feb-10 16:17 
QuestionSending AT commands to a v.92 USB modem Pin
saeidfarahi1-Feb-10 11:55
saeidfarahi1-Feb-10 11:55 
AnswerRe: Sending AT commands to a v.92 USB modem Pin
Luc Pattyn1-Feb-10 12:10
sitebuilderLuc Pattyn1-Feb-10 12:10 
Hi,

I have several comments:

1.
having a thread execute an empty loop is the perfect way to waste a CPU core. Are you sure you want this? I wouldn't.

2.
you may want to clear both inbound and outbound buffers when using a serial port. if anything is still in there, your PC app or your peripheral could receive it once the conditions are right.

3.
The DataReceived event is raised when some data is available (some as in "an undefined quantity"). Only reading a single line of text may not return all that is available. You might just have looked over the data you are expecting!

4.
modems (or whatever is at the far end) may echo all incoming characters; that is what you would hope for when using a terminal+modem to connect to a distant computer e.g.

5.
if relying on messages (e.g. strings terminated by \r\n) you might want to explicitly program the terminator; Environment.NewLine (I assume that is the default for SerialPort.NewLine) may vary when your app travels the world and/or goes to non-Windows platforms.

6.
The hardest one of all: serial communication can be very hard; there isn't much that forces message characters (such as text ending on \r\n) to stay together; you might get a DataReceived event halfway, etc.
I tend to do one of these two:
- insert a small delay between event and Read operation
- or provide my own buffering, then extract messages when they are completely available within my buffer.

Smile | :)

Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]


AnswerRe: Sending AT commands to a v.92 USB modem Pin
PIEBALDconsult1-Feb-10 15:01
mvePIEBALDconsult1-Feb-10 15:01 
GeneralRe: Sending AT commands to a v.92 USB modem Pin
Luc Pattyn1-Feb-10 15:11
sitebuilderLuc Pattyn1-Feb-10 15:11 
Questionrandom in background [modified] Pin
Mark H Bishop1-Feb-10 11:21
Mark H Bishop1-Feb-10 11:21 
AnswerRe: random in background Pin
harold aptroot1-Feb-10 11:39
harold aptroot1-Feb-10 11:39 
AnswerRe: random in background Pin
Abhinav S1-Feb-10 11:43
Abhinav S1-Feb-10 11:43 
GeneralRe: random in background Pin
Mark H Bishop2-Feb-10 4:05
Mark H Bishop2-Feb-10 4:05 
AnswerRe: random in background Pin
Luc Pattyn1-Feb-10 12:11
sitebuilderLuc Pattyn1-Feb-10 12:11 
Questionhow to expose an event in user control Pin
nuttynibbles1-Feb-10 10:37
nuttynibbles1-Feb-10 10:37 
AnswerRe: how to expose an event in user control Pin
#realJSOP1-Feb-10 10:47
mve#realJSOP1-Feb-10 10:47 
AnswerRe: how to expose an event in user control Pin
DaveyM691-Feb-10 12:10
professionalDaveyM691-Feb-10 12:10 
GeneralRe: how to expose an event in user control Pin
nuttynibbles1-Feb-10 16:51
nuttynibbles1-Feb-10 16:51 
QuestionAdding and removing differences from List compared to another list Pin
zagitta1-Feb-10 10:34
zagitta1-Feb-10 10:34 
AnswerRe: Adding and removing differences from List compared to another list Pin
#realJSOP1-Feb-10 10:51
mve#realJSOP1-Feb-10 10:51 
GeneralRe: Adding and removing differences from List compared to another list Pin
zagitta1-Feb-10 11:29
zagitta1-Feb-10 11:29 
GeneralRe: Adding and removing differences from List compared to another list Pin
#realJSOP1-Feb-10 23:20
mve#realJSOP1-Feb-10 23:20 
GeneralRe: Adding and removing differences from List compared to another list Pin
zagitta2-Feb-10 2:55
zagitta2-Feb-10 2:55 
GeneralRe: Adding and removing differences from List compared to another list Pin
Dan Mos2-Feb-10 7:36
Dan Mos2-Feb-10 7:36 

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.