LAN의 모든 IP 주소를 ListBox에 표시해야합니다. 내가 비어있는 것을 묶으려고 할 때.LAN에서 모든 IP 주소 표시
// 코드
내가 틀렸다 Process netUtility = new Process();
netUtility.StartInfo.FileName = "net.exe";
netUtility.StartInfo.CreateNoWindow = true;
netUtility.StartInfo.RedirectStandardOutput = true;
netUtility.StartInfo.UseShellExecute = false;
netUtility.StartInfo.RedirectStandardError = true;
netUtility.Start();
StreamReader streamReader = new StreamReader(netUtility.StandardOutput.BaseStream);
string line = "";
while ((line = streamReader.ReadLine()) != null)
{
if (line.StartsWith("\\"))
{
ListBox1.Items.Add(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper());
}
}
streamReader.Close();
netUtility.WaitForExit(1000);
?
가능한 복제 다음 링크를보고하십시오, [http://stackoverflow.com/questions/965088/get-all-ips-in-the-same-network-as-my-computer][1] [1] : http://stackoverflow.com/questions/965088/get-all-ips-in-the-same-network-as-my-computer –