G
Guest
got the following code snippet that i've modified off the internet to work -
but damn if i know how and i dont like that. im having trouble with the
following thread declaration that creates the thread, calls the ScanPorts
method in the ScanPorts class and somehow passes in the array list
scannedSystems. i'm stumped - how does it do all that on one line? thanks
all.
private ArrayList scannedSystems;
scannedSystems.Add(new ScanPorts(ipAddress, port);
Thread scanThread = new Thread ( new ThreadStart
(((ScanPorts)scannedSystems[0]).systemScan));
scanThread.Start();
public class ScanPorts
{
private string address = "";
private int scannedPort;
public ScanPorts(string ipAddress, int port)
{
string address = ipAddress;
int scannedPort = port;
}
public void systemScan()
{
TcpClient tcpClient = new TcpClient();
try
{
tcpClient.Connect(address, scannedPort);
}
catch{}
}
}
but damn if i know how and i dont like that. im having trouble with the
following thread declaration that creates the thread, calls the ScanPorts
method in the ScanPorts class and somehow passes in the array list
scannedSystems. i'm stumped - how does it do all that on one line? thanks
all.
private ArrayList scannedSystems;
scannedSystems.Add(new ScanPorts(ipAddress, port);
Thread scanThread = new Thread ( new ThreadStart
(((ScanPorts)scannedSystems[0]).systemScan));
scanThread.Start();
public class ScanPorts
{
private string address = "";
private int scannedPort;
public ScanPorts(string ipAddress, int port)
{
string address = ipAddress;
int scannedPort = port;
}
public void systemScan()
{
TcpClient tcpClient = new TcpClient();
try
{
tcpClient.Connect(address, scannedPort);
}
catch{}
}
}