scan the your Lan ip's using dos command " net view" it would give all machine names and then from that machine names get their corresponding ip's. then combine ipaddress and the port u want to scan, thru this code for (int CurrPort = 1; CurrPort <= 25; CurrPort++) { TcpClient TcpScan = new TcpClient(); try { // Try to connect TcpScan.Connect("192.168.0.1", CurrPort); // If there's no exception, we can say the port is open MessageBox.Show("Port " + CurrPort + " open"); } catch { // An exception occured, thus the port is probably closed MessageBox.Show("Port " + CurrPort + " closed"); } }