If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

C#:only the backgroundwork running

Hi every one!
I am trying to create a port scanner , I would be able to generate numbers of backgroundworker and each bgwork would scan ports simultaneously, but when I generate 10 bgworkers, there is only the last one working ?! I don't know why? but if I re-click the button there is another bgworker come out and working simultaneously, any body know the reason ? please full fill my knowledge!
thank you

C#:only the backgroundwork running

Hi every one!
I am trying to create a port scanner , I would be able to generate numbers of backgroundworker and each bgwork would scan ports simultaneously, but when I generate 10 bgworker , there is only the lasst one working ?! I don't know why? but if I re-click the button there is another bgworker come out and working simultaneously, any body know the reason ? please full fill my knowledge!
thank you
private void DoAsSyncScan(int index,int begin = IPEndPoint.MinPort, int end = IPEndPoint.MaxPort)
{
String ScanAddress;
IPAddress ScanIPAddress;
startedflg = true;
try
{
ScanAddress = "127.0.0.1";
Action atxtb = () =>
{
if (textBoxIP.Text != string.Empty)
ScanAddress = textBoxIP.Text;
};
Dispatcher.BeginInvoke(atxtb);

// Both a hostname or an IP address are fine
if (PortScanning.PortScanning.IsIpAddress(ScanAddress))
{
ScanIPAddress = IPAddress.Parse(ScanAddress);
}
else if (!PortScanning.PortScanning.LookupDNSName(ScanAddress, out ScanIPAddress))
{
MessageBox.Show("Error looking up {0}", ScanAddress);
return;
}

you see the old code is DoAsSyncScan(begin, begin * part, begin * part); so the first threads would be ended immediately but not the final thread, I have set a condition IPEndPoint.MaxPort > (begin + 1) * part but I didn't use begin+1 , that's the problem , it takes me 3 days , it was something stupid! , whatever I have learn alot

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.