Click here to Skip to main content
15,905,971 members
Home / Discussions / C#
   

C#

 
QuestionSite not working on IE9 for production server Pin
nitin_ion10-Aug-14 23:03
nitin_ion10-Aug-14 23:03 
SuggestionRe: Site not working on IE9 for production server Pin
Richard MacCutchan11-Aug-14 0:37
mveRichard MacCutchan11-Aug-14 0:37 
AnswerRe: Site not working on IE9 for production server Pin
Dave Kreskowiak11-Aug-14 3:07
mveDave Kreskowiak11-Aug-14 3:07 
AnswerRe: Site not working on IE9 for production server Pin
Pete O'Hanlon11-Aug-14 5:27
mvePete O'Hanlon11-Aug-14 5:27 
QuestionExcel.interop error Pin
Member 1098941510-Aug-14 20:28
Member 1098941510-Aug-14 20:28 
SuggestionRe: Excel.interop error Pin
Kornfeld Eliyahu Peter10-Aug-14 20:47
professionalKornfeld Eliyahu Peter10-Aug-14 20:47 
AnswerRe: Excel.interop error Pin
Richard MacCutchan10-Aug-14 21:29
mveRichard MacCutchan10-Aug-14 21:29 
QuestionProblem with my C# code for Motorola MC5574 barcode reader Pin
Jaspar Lamar Crabb10-Aug-14 11:26
Jaspar Lamar Crabb10-Aug-14 11:26 
AnswerRe: Problem with my C# code for Motorola MC5574 barcode reader Pin
Richard Andrew x6410-Aug-14 16:08
professionalRichard Andrew x6410-Aug-14 16:08 
AnswerRe: Problem with my C# code for Motorola MC5574 barcode reader Pin
Bernhard Hiller10-Aug-14 21:41
Bernhard Hiller10-Aug-14 21:41 
AnswerRe: Problem with my C# code for Motorola MC5574 barcode reader Pin
Gerry Schmitz11-Aug-14 19:52
mveGerry Schmitz11-Aug-14 19:52 
Questiondownload webpage Complete Pin
Member 94738099-Aug-14 22:48
Member 94738099-Aug-14 22:48 
AnswerRe: download webpage Complete Pin
Richard MacCutchan10-Aug-14 1:51
mveRichard MacCutchan10-Aug-14 1:51 
QuestionRe: download webpage Complete Pin
Member 947380910-Aug-14 4:07
Member 947380910-Aug-14 4:07 
AnswerRe: download webpage Complete Pin
Richard MacCutchan10-Aug-14 6:09
mveRichard MacCutchan10-Aug-14 6:09 
AnswerRe: download webpage Complete Pin
Kornfeld Eliyahu Peter10-Aug-14 6:28
professionalKornfeld Eliyahu Peter10-Aug-14 6:28 
GeneralRe: download webpage Complete Pin
Member 947380910-Aug-14 18:32
Member 947380910-Aug-14 18:32 
QuestionRe: download webpage Complete Pin
Member 947380911-Aug-14 5:42
Member 947380911-Aug-14 5:42 
AnswerRe: download webpage Complete Pin
Eddy Vluggen11-Aug-14 7:06
professionalEddy Vluggen11-Aug-14 7:06 
QuestionRe: download webpage Complete Pin
Member 947380911-Aug-14 21:33
Member 947380911-Aug-14 21:33 
AnswerRe: download webpage Complete Pin
thatraja11-Aug-14 23:15
professionalthatraja11-Aug-14 23:15 
QuestionHow to process data asynchronous when (socket ) recieving data high frequently Pin
Peng20139-Aug-14 6:53
Peng20139-Aug-14 6:53 
Now I process the data synchronized, when recieving the data it deal data.
But I found the data is high frequently recieved, And it waste too much time to process data.

So, I hope to process data asynchronous and ensure the data sequence, not to block the trecieve thread.
I read some arcitles, I get two methods:
1) when recieving data ,right now use " task.factory.startnew..."
2) when recieving data , "enqueue" the data to ConcurrentQueue, According to different data type, i use 8 queues. And the the program is started,
starting 8 threads to dequeue data for every ConcurrentQueue and process it.
C#
public form1(){
Task.factory.startnew(()=>processData(1));
Task.factory.startnew(()=>processData(2));
Task.factory.startnew(()=>processData(3));
Task.factory.startnew(()=>processData(4));
Task.factory.startnew(()=>processData(5));
Task.factory.startnew(()=>processData(6));
Task.factory.startnew(()=>processData(7));
Task.factory.startnew(()=>processData(8));
}

//recieve data high frequently 
void OndataReceive( string data){
if( ..){
queue1.Enqueue(data);
}
else if(...)
{
queue2.Enqueue(data);
}
....


retutn;
}

void processData(int queueID){
while(true){
ConcurrentQueue queue = getqueue(queueID)

for(int i =0; i < queue.Count; i++){
string s;
queue.TryDequeue(out s);
.....
}
Thread.Sleep(10);
}.
}


I test the above 2). I found CPU and the memory footprint is large ....

How should I solve this problem ?

Thanks
Andrew

modified 10-Aug-14 9:36am.

AnswerRe: How to process data asynchronous when (socket ) recieving data high frequently Pin
Eddy Vluggen11-Aug-14 7:08
professionalEddy Vluggen11-Aug-14 7:08 
Questionngen in windows applications c# Pin
Zeyad Jalil9-Aug-14 2:03
professionalZeyad Jalil9-Aug-14 2:03 
AnswerRe: ngen in windows applications c# Pin
Dave Kreskowiak9-Aug-14 4:25
mveDave Kreskowiak9-Aug-14 4:25 

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.