|
private void btn0_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
check();
if (btn.Name == btn0.Name)
{
txtcalculate.Text = txtcalculate.Text + "0";
}
if (btn.Name == btn1.Name)
{
txtcalculate.Text = txtcalculate.Text + "1";
}
if (btn.Name == btn2.Name)
{
txtcalculate.Text = txtcalculate.Text + "2";
}
}
//make all the button event to be btn0_Click
Padmanabhan
|
|
|
|
|
Thank you. Got it working now
|
|
|
|
|
hi peoples..
i m designing an application in wpf scree, of which i have to dunamically move the label.. for that i have to set the margin,
how to set the margin in c# coding??
|
|
|
|
|
yourLabelName.Margin = new Thickness(5);
Try asking in the WPF forum next time.
(Also setting the margin from code kinda breaks the idea of WPF code/UI separation, you should be binding to something instead, but I'm not gonna interfere, maybe your doing it for a good reason. Just read about MVVM and WPF design)
Simon
|
|
|
|
|
Hi there,
I'm working on a program which has to record as many video streams as it can, coming from a server. I tested the source capacity with some other programs and it got up to 100 streams coming without any problem.
So I made my own program, using a class which starts a thread. This thread opens a connection using HttpWebRequest and gets its response stream and writes incoming data into a file, all of them done synchronously.
I create one class per one video stream. using this method everything is OK just before I reach 10 records, from this time on, no new stream opens.
What do I have to do?
I'm not reaching any memory, network bandwidth or things like that.
Thanks for your help.
|
|
|
|
|
Limitation on concurrently running threads would be my assumption, from a quick search on google you can only have 25 threads running concurrently.
Check me out[^]
|
|
|
|
|
I don't think so.
1. The ThreadPool has some methods to find out the limits, and they typically are well above 100. I got maxPoolThreads=500 the other day.
2. It isn't even sure the ThreadPool is getting involved in all this.
I rather suspect the networking itself having a built-in concurrency limitation.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
That's why you have a 'spiffy-er' icon then me.
I knew it had to do with concurrent thread limitations, just I remembered reading the XP SP2 had reduced the limit to 50 (I think, may be smaller) so I just assumed it was a .net limitation.
You're probably right though, it was a loooo-ooo-ooo-ng time ago.
|
|
|
|
|
EliottA wrote: That's why you have a 'spiffy-er' icon then me.
Yes the icon is fine, however on the who-is-who pages 5000-plussers get called "fixtures", makes me feel like part of the furniture around here.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks for answers, but I found the reason.
I just found out about req.ServicePoint.ConnectionLimit where req is my HttpWebRequest object. I had to increase this one instead of ServicePointManager.DefaultConnectionLimit.
now I got 60 threads running simultaneously but I want to ask if there is such a limit to concurrent threads or I can increase thread counts up to any where?
Thanks again
|
|
|
|
|
Hi,
AFAIK the Thread class can be instantiated as long as you don't run out of very basic resources, such as virtual memory (maybe physical memory), and Windows handles. After all, when you look at Task Manager, Windows is running some 100 processes while "doing nothing", and most of these processes have several threads.
There are some limitations in other layers, some fixed, some variable; IIRC the maximum number of threads in the ThreadPool is fixed as the ThreadPool is used by .NET initialization code, hence it is created when a .NET process gets started but long before the user's code is running. And they did not provide a way to grow it.
Networking code often has limitations because it is deemed counterproductive to exceed a certain number, which probably is right most of the time, but would work against you in some situations, e.g. when you want to stress test a server with as few physical clients as possible.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Check it out
CSHarpHelp.Com wrote:
It starts the 10 threads using .Net Thread pool object. At the end of the code, it again gets the max thread count using GetMaxThreads method. This time it should display the same value which being set by SetMaxThreads method.
The main purpose of this article is not to test ThreadPool class or its functionality. The only purpose of this application is to show how to adjust the max thread count of the ThreadPool class..
Maybe .Net has a max Thread count of 10?
From here[^]
|
|
|
|
|
I vaguely remember some low ThreadPool limits long ago (probably .NET 1.0) but that link IMO is way outdated. Since programmers often want threads that basically sit around waiting for something to happen (e.g. performing synchronous I/O rather than asynchronous, at the expense of extra stacks) Microsoft must have felt a need to dramatically increase the limit. As I mentioned in the other post, AFAIK it still officially is a constant due to very early instantiation of the ThreadPool, but in my experience a rather large one.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
For worker threads in the thread pool the max value ( per processor ) changed from 25 to 250 as of CLR 2.0 SP1. The normal problem, however, is that after you have one thread per processor, the thread pool will only ever create one extra thread every half a second. So if you start off with 0 threads ( the default minimum ) on a 4-core box, in 10 seconds it will only ramp up to [ 4 + 10 * 2 ] = 24 threads.
This is why ASP.NET sets the minimum to 50 ( per processor ) by default.
BTW, I just checked in CLR 4.0 and it appears the limit has been raised to 4096 per processor!
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Wow. great info.
I wasn't aware thread creation was throttled like that.
Did you get that from an official document somewhere?
Thanks.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
Many thanks.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Async or Overlapped I/O is the most efficient Socket I/O mechanism.
link[^]
The next step in scaling up the server is to use asynchronous I/O. Asynchronous I/O alleviates the need to create and manage threads. This leads to much simpler code and also is a more efficient I/O model. Asynchronous I/O utilizes callbacks to handle incoming data and connections, which means there are no lists to set up and scan and there is no need to create new worker threads to deal with the pending I/O.
|
|
|
|
|
But every recorder has to be a separate recorder and also it's very time critical to answer back the status specially for retrying the unsuccessful connection and things like this.
Do you think it's going to be a great difference in performance?
I have tested my recorder with 100 threads and I think I'm loosing some bytes compared to lower count of threads, do you think it's possible? or I'm just thinking that it happens?
|
|
|
|
|
1)How can i get the webcam resolution? not modify only obtain the resolution.
2) How can I print on the image from the webcam the time and the date?
|
|
|
|
|
www.rentacoder.com
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
Hi Guys. I have written a FileWatcher WindowsService which works fine. Now, I want to go a step further. I have written a Windows App that the guys are currently using to convert files with. I want to incorporate this into the WindowsService. What is the best way of doing this? Would it be adviseable for me to code the conversion stuff into the service in the FileSystemWatcher_Created Event? Is this even possible? I have searched and I can't find anything that would suggest that this is possible or how it can be done.
Has anybody done anything like this before? If yes how?
Thanks
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
I would write a second Service to do the conversion.
On my last job I had several Services; of which one ran reports of different types and another handled emailing the results to whoever needed them.
|
|
|
|
|
And how would I start or call this from withing the current service? Sorry for asking, this is the first time I'm dabbling in WindowsServices.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|