Click here to Skip to main content
15,562,816 members
Home / Discussions / C#
   

C#

 
AnswerRe: download webpage Complete Pin
Richard MacCutchan10-Aug-14 7:09
mveRichard MacCutchan10-Aug-14 7:09 
AnswerRe: download webpage Complete Pin
Kornfeld Eliyahu Peter10-Aug-14 7:28
professionalKornfeld Eliyahu Peter10-Aug-14 7:28 
GeneralRe: download webpage Complete Pin
Member 947380910-Aug-14 19:32
Member 947380910-Aug-14 19:32 
QuestionRe: download webpage Complete Pin
Member 947380911-Aug-14 6:42
Member 947380911-Aug-14 6:42 
AnswerRe: download webpage Complete Pin
Eddy Vluggen11-Aug-14 8:06
professionalEddy Vluggen11-Aug-14 8:06 
QuestionRe: download webpage Complete Pin
Member 947380911-Aug-14 22:33
Member 947380911-Aug-14 22:33 
AnswerRe: download webpage Complete Pin
thatraja12-Aug-14 0:15
professionalthatraja12-Aug-14 0:15 
QuestionHow to process data asynchronous when (socket ) recieving data high frequently Pin
Peng20139-Aug-14 7:53
Peng20139-Aug-14 7: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 8:08
professionalEddy Vluggen11-Aug-14 8:08 
Questionngen in windows applications c# Pin
Zeyad Jalil9-Aug-14 3:03
professionalZeyad Jalil9-Aug-14 3:03 
AnswerRe: ngen in windows applications c# Pin
Dave Kreskowiak9-Aug-14 5:25
mveDave Kreskowiak9-Aug-14 5:25 
GeneralRe: ngen in windows applications c# Pin
Zeyad Jalil9-Aug-14 20:27
professionalZeyad Jalil9-Aug-14 20:27 
GeneralRe: ngen in windows applications c# Pin
Dave Kreskowiak10-Aug-14 5:45
mveDave Kreskowiak10-Aug-14 5:45 
AnswerRe: ngen in windows applications c# Pin
V.10-Aug-14 8:20
professionalV.10-Aug-14 8:20 
QuestionMulti-label Classifiers based Associative Classification (MCAC) algorithm Pin
sadish67-Aug-14 18:03
sadish67-Aug-14 18:03 
AnswerRe: Multi-label Classifiers based Associative Classification (MCAC) algorithm Pin
Mycroft Holmes7-Aug-14 19:02
professionalMycroft Holmes7-Aug-14 19:02 
AnswerRe: Multi-label Classifiers based Associative Classification (MCAC) algorithm Pin
OriginalGriff7-Aug-14 22:30
mvaOriginalGriff7-Aug-14 22:30 
QuestionDotNetBar (DevComponents) DockingContainer Pin
HobbyProggy7-Aug-14 2:53
professionalHobbyProggy7-Aug-14 2:53 
AnswerRe: DotNetBar (DevComponents) DockingContainer Pin
Eddy Vluggen8-Aug-14 0:24
professionalEddy Vluggen8-Aug-14 0:24 
Questionassign the filed for XtraReport of Devexpress ? Pin
Member 24584677-Aug-14 1:01
Member 24584677-Aug-14 1:01 
Question.net Query Pin
Member 109952356-Aug-14 23:26
Member 109952356-Aug-14 23:26 
AnswerRe: .net Query Pin
Richard MacCutchan6-Aug-14 23:40
mveRichard MacCutchan6-Aug-14 23:40 
AnswerRe: .net Query Pin
Keith Barrow7-Aug-14 2:45
professionalKeith Barrow7-Aug-14 2:45 
AnswerRe: .net Query Pin
Gerry Schmitz7-Aug-14 12:00
mveGerry Schmitz7-Aug-14 12:00 
QuestionConnecting to License Application on Server Pin
Jassim Rahma6-Aug-14 21:25
Jassim Rahma6-Aug-14 21: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.