Click here to Skip to main content
15,890,282 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
naouf1023-Dec-15 11:41
naouf1023-Dec-15 11:41 
AnswerRe: How do I read data from USB Virtual COM in C#? Pin
Gerry Schmitz23-Dec-15 11:07
mveGerry Schmitz23-Dec-15 11:07 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
naouf1023-Dec-15 11:39
naouf1023-Dec-15 11:39 
AnswerRe: How do I read data from USB Virtual COM in C#? Pin
OriginalGriff23-Dec-15 11:57
mveOriginalGriff23-Dec-15 11:57 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
naouf1023-Dec-15 14:30
naouf1023-Dec-15 14:30 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
Gerry Schmitz23-Dec-15 12:05
mveGerry Schmitz23-Dec-15 12:05 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
naouf1023-Dec-15 14:45
naouf1023-Dec-15 14:45 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
Gerry Schmitz23-Dec-15 16:11
mveGerry Schmitz23-Dec-15 16:11 
C#
int bytesToRead = 0;

for ( int i = 0; i < 5; i++ ) {
   bytesToRead = _serialPort.BytesToRead;

   if ( bytesToRead > 0 ) {
      break;
   }

   Thread.Sleep( 50 );

}  // end for.

Setting timeouts is trial-and-error; you just need to insure they are "long enough".

I've been in situations where the timeouts needed varying from 250ms up to 5000ms; depending on the environment (i.e. network).

Another thing: Serial devices don't typically just "send"; they respond to requests. i.e. You send data to the device; it responds ... even if it is just with an error.

If there is no "command" that you can send to the device and for which you can expect a response (like "current status"), then you are missing something (like RTFM).
AnswerRe: How do I read data from USB Virtual COM in C#? Pin
Luc Pattyn23-Dec-15 17:24
sitebuilderLuc Pattyn23-Dec-15 17:24 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
naouf1026-Dec-15 3:44
naouf1026-Dec-15 3:44 
GeneralRe: How do I read data from USB Virtual COM in C#? Pin
Agent__00730-Dec-15 15:45
professionalAgent__00730-Dec-15 15:45 
QuestionIs there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin23-Dec-15 0:03
Emanuele Bonin23-Dec-15 0:03 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
Richard MacCutchan23-Dec-15 0:30
mveRichard MacCutchan23-Dec-15 0:30 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
Eddy Vluggen23-Dec-15 1:49
professionalEddy Vluggen23-Dec-15 1:49 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
BillWoodruff23-Dec-15 5:04
professionalBillWoodruff23-Dec-15 5:04 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Eddy Vluggen23-Dec-15 6:34
professionalEddy Vluggen23-Dec-15 6:34 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
BillWoodruff23-Dec-15 19:44
professionalBillWoodruff23-Dec-15 19:44 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Eddy Vluggen24-Dec-15 1:30
professionalEddy Vluggen24-Dec-15 1:30 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin24-Dec-15 9:51
Emanuele Bonin24-Dec-15 9:51 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin24-Dec-15 9:58
Emanuele Bonin24-Dec-15 9:58 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin24-Dec-15 9:55
Emanuele Bonin24-Dec-15 9:55 
AnswerRe: Is there a better way to call Same Methods on different objects ? Pin
Gerry Schmitz24-Dec-15 8:11
mveGerry Schmitz24-Dec-15 8:11 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin26-Dec-15 5:28
Emanuele Bonin26-Dec-15 5:28 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Gerry Schmitz26-Dec-15 7:43
mveGerry Schmitz26-Dec-15 7:43 
GeneralRe: Is there a better way to call Same Methods on different objects ? Pin
Emanuele Bonin26-Dec-15 8:40
Emanuele Bonin26-Dec-15 8:40 

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.