Click here to Skip to main content
15,892,537 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: ngen in windows applications c# Pin
Zeyad Jalil9-Aug-14 19:27
professionalZeyad Jalil9-Aug-14 19:27 
GeneralRe: ngen in windows applications c# Pin
Dave Kreskowiak10-Aug-14 4:45
mveDave Kreskowiak10-Aug-14 4:45 
AnswerRe: ngen in windows applications c# Pin
V.10-Aug-14 7:20
professionalV.10-Aug-14 7:20 
QuestionMulti-label Classifiers based Associative Classification (MCAC) algorithm Pin
sadish67-Aug-14 17:03
sadish67-Aug-14 17:03 
AnswerRe: Multi-label Classifiers based Associative Classification (MCAC) algorithm Pin
Mycroft Holmes7-Aug-14 18:02
professionalMycroft Holmes7-Aug-14 18:02 
AnswerRe: Multi-label Classifiers based Associative Classification (MCAC) algorithm Pin
OriginalGriff7-Aug-14 21:30
mveOriginalGriff7-Aug-14 21:30 
QuestionDotNetBar (DevComponents) DockingContainer Pin
HobbyProggy7-Aug-14 1:53
professionalHobbyProggy7-Aug-14 1:53 
AnswerRe: DotNetBar (DevComponents) DockingContainer Pin
Eddy Vluggen7-Aug-14 23:24
professionalEddy Vluggen7-Aug-14 23:24 
Questionassign the filed for XtraReport of Devexpress ? Pin
Member 24584677-Aug-14 0:01
Member 24584677-Aug-14 0:01 
Question.net Query Pin
Member 109952356-Aug-14 22:26
Member 109952356-Aug-14 22:26 
AnswerRe: .net Query Pin
Richard MacCutchan6-Aug-14 22:40
mveRichard MacCutchan6-Aug-14 22:40 
AnswerRe: .net Query Pin
Keith Barrow7-Aug-14 1:45
professionalKeith Barrow7-Aug-14 1:45 
AnswerRe: .net Query Pin
Gerry Schmitz7-Aug-14 11:00
mveGerry Schmitz7-Aug-14 11:00 
QuestionConnecting to License Application on Server Pin
Jassim Rahma6-Aug-14 20:25
Jassim Rahma6-Aug-14 20: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.