Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Exception socket
0 down vote favorite

 
i am trying to get network connected computers ip's of selected from the listview by checkboxes code is given below , answer will be appriciated and thanks in advance reply urgent kindly
 
private void Form1_Load(object sender, EventArgs e) {
 
NetworkBrowser nb = new NetworkBrowser();
foreach (string pc in nb.getNetworkComputers())
{
listViewEx1.Items.Add(pc, 0);
 
}
 
}
 
private void button1_Click(object sender, EventArgs e)
{
foreach (ListViewItem chkd in listViewEx1.CheckedItems)
{
IPAddress[] addresslist = Dns.GetHostAddresses(chkd.ToString());
foreach (IPAddress ip in addresslist)
{
MessageBox.Show(ip.ToString());
}
 
// MessageBox.Show(chkd.ToString());
 
}
}
Posted 30-May-13 8:21am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You tried to connect using misspelled IP or host name, or this IP is not accessible from the location of the client.
 
—SA
  Permalink  
Comments
Member 8888044 at 30-May-13 14:09pm
   
thanks for reply but i am using host names selected from listview , get by above function getNetworkComputers so name are right i think. u can run and check main problem in a minute
Sergey Alexandrovich Kryukov at 30-May-13 14:37pm
   
The network "computer name" does not have to be a valid name. I don't really know what names are collected by nb. What is you URL scheme ("http://" or something else)? You can manually check it. Are you using HTTP or some other well-known Web protocol? Then you can check it up with available Web browser...
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

i got it
IPAddress[] addresslist = Dns.GetHostAddresses(chkd.text); will be used
u were right sir it was misspelled prblm
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 30 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100