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

C#

 
QuestionHow to plug/unplug USB serial port problematically? Pin
pallaka27-Oct-09 2:09
pallaka27-Oct-09 2:09 
AnswerDo not cross post Pin
dan!sh 27-Oct-09 2:13
professional dan!sh 27-Oct-09 2:13 
GeneralRe: Do not cross post Pin
pallaka27-Oct-09 3:03
pallaka27-Oct-09 3:03 
GeneralRe: Do not cross post Pin
Not Active27-Oct-09 3:08
mentorNot Active27-Oct-09 3:08 
AnswerRe: How to plug/unplug USB serial port problematically? Pin
anishkannan27-Oct-09 8:36
anishkannan27-Oct-09 8:36 
Questioncrystal report error Pin
indenturetech27-Oct-09 2:01
indenturetech27-Oct-09 2:01 
QuestionAsynchronous Sockets Pin
joana.simoes27-Oct-09 1:44
joana.simoes27-Oct-09 1:44 
AnswerRe: Asynchronous Sockets Pin
Paulo Zemek27-Oct-09 3:04
mvaPaulo Zemek27-Oct-09 3:04 
I didn't debug the code, but I see you used a lot of async calls. Do you really need that much of async calls?

I will explain: If I am not wrong, every async call will use a ThreadPool thread. So, on the first callback you will be in a thread-pool thread (instead of the main one). Generating a new async callback will only use a new Thread to do the parallel work, for something that is already in parallel.

So, maybe you can simplify everything simple doing everything "sinchronously" inside a ThreadPool thread, by using a ThreadPool.QueueUserWorkItem. I think this way the code will get more readable, you will make it work and also will be faster, as it will use only one thread instead of 3 or 4 threads to finish the work.

Also, for the read (not the write) note that you may ask to read 100 bytes and the read can read 3 bytes and return 3. This way, if you REALLY need that 100 bytes, you will need to call read again, as many times as needed or even throw an exception if the connection is closed before it finishes.
GeneralRe: Asynchronous Sockets Pin
joana.simoes28-Oct-09 7:28
joana.simoes28-Oct-09 7:28 
AnswerRe: Asynchronous Sockets Pin
Jimmanuel27-Oct-09 5:00
Jimmanuel27-Oct-09 5:00 
Questionencrypt the app.config Pin
reza assar27-Oct-09 1:35
reza assar27-Oct-09 1:35 
AnswerRe: encrypt the app.config Pin
Pete O'Hanlon27-Oct-09 1:45
mvePete O'Hanlon27-Oct-09 1:45 
Questionlock some text files Pin
reza assar27-Oct-09 1:28
reza assar27-Oct-09 1:28 
AnswerRe: lock some text files Pin
Eddy Vluggen27-Oct-09 8:14
professionalEddy Vluggen27-Oct-09 8:14 
GeneralRe: lock some text files Pin
reza assar9-Nov-09 18:36
reza assar9-Nov-09 18:36 
GeneralRe: lock some text files Pin
Eddy Vluggen10-Nov-09 3:42
professionalEddy Vluggen10-Nov-09 3:42 
QuestionADO.NET Entity Framework Pin
Pankaj Saha27-Oct-09 1:27
Pankaj Saha27-Oct-09 1:27 
AnswerRe: ADO.NET Entity Framework Pin
Not Active27-Oct-09 2:12
mentorNot Active27-Oct-09 2:12 
Questionactive single instance only Pin
reza assar27-Oct-09 1:24
reza assar27-Oct-09 1:24 
AnswerRe: active single instance only Pin
N a v a n e e t h27-Oct-09 1:28
N a v a n e e t h27-Oct-09 1:28 
GeneralRe: active single instance only Pin
Hristo-Bojilov27-Oct-09 1:58
Hristo-Bojilov27-Oct-09 1:58 
GeneralRe: active single instance only Pin
N a v a n e e t h27-Oct-09 2:10
N a v a n e e t h27-Oct-09 2:10 
GeneralRe: active single instance only Pin
Hristo-Bojilov27-Oct-09 2:22
Hristo-Bojilov27-Oct-09 2:22 
GeneralRe: active single instance only Pin
Luc Pattyn27-Oct-09 4:16
sitebuilderLuc Pattyn27-Oct-09 4:16 
AnswerRe: active single instance only Pin
anishkannan27-Oct-09 1:47
anishkannan27-Oct-09 1:47 

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.