-
August 14th, 2013, 02:00 PM
#1
Asking for an Advice
I am totaly a newbie of C# and developing.
I am trying to build a solution that has to use a socket.
So far I got quite honest results.
A part of my code is made in this way:
Code:
while (true)
{
try
{
data1 = mystreamreader.ReadLine();
listBox1.Items.Add(data1);
i++;
//MessageBox.Show(data1);
}
catch
{
}
}
As you can see this is a loop that permit me to have a push on a TCP stream (by using Socket).
The problem is that while the while loop is going my application works but is almost frozen. So is impossible to proceed with others threads.
I would like to use the multithreading tecnology but I don't know how to implement it. I mean ... how I can call method in a thread class of objects that are defined in other parts of the code?
Can you help me giving some advices or solution
Thanks in advance
-
August 15th, 2013, 11:13 AM
#2
Re: Asking for an Advice
How do you exit from the while (true) block?
-
August 16th, 2013, 01:24 AM
#3
Re: Asking for an Advice
Originally Posted by zips
How do you exit from the while (true) block?
Actually I don't need to quit. The only thing might be I can changhe the while condition.
Any advices on threading using?
-
August 16th, 2013, 03:58 PM
#4
Re: Asking for an Advice
Search bing or google for "Using a thread in Windows Forms example".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|