Obtain the network neighbor information of the web server's LAN

Source: Internet
Author: User

The previous article mentioned the use of the Messenger Service on the web.
I used the following methods to obtain client information in a LAN (peer network:

Using system. directoryservices; // reference the namespace

Directoryentry entrypc = new directoryentry ("winnt :");
Foreach (directoryentry child in entrypc. Children)
{
Treenode node = new treenode ();
Node. Text = Child. schemaclassname + ":" + child. Name;
Pctree. nodes. Add (node );

Foreach (directoryentry PC in child. Children)
{
If (string. Compare (PC. schemaclassname, "computer", true) = 0)
{
Treenode son = new treenode ();
Son. Text = pc. Name;
Node. nodes. Add (son );
}
}
}

Note: if there are many computers in the LAN, this process will be slow, so you need to adopt some policies to get a faster client experience.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.