如何在我们的网络中注册所有已打开的计算机? [英] How do I register all turned on computers in our network?

查看:111
本文介绍了如何在我们的网络中注册所有已打开的计算机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public static bool IsConnectedToInternet
{
    get
    {
        Uri url = new Uri("www.abhisheksur.com");
        string pingurl = string.Format("{0}", url.Host);
        string host = pingurl;
        bool result = false;
        Ping p = new Ping();
        try
        {
            PingReply reply = p.Send(host, 3000);
            if (reply.Status == IPStatus.Success)
                return true;
        }
        catch { }
        return result;
    }
}



也许是这样的?但它实际上应该扫描一个整个子网..你能帮我解决这个问题吗?


Maybe like this? But it should actually scan a whole subnet.. Can you pls help me with this?

推荐答案

我会看看NetAPI32.dll NetServerEnum函数(需要p /调用和关心在64位机器上运行)



结账

使用C#重新获取网络计算机名称列表 [ ^ ] [/ edit]



I'd be looking at the NetAPI32.dll NetServerEnum function (requires p/invoke and care running on 64bit machines)

[edit] check out
Retreiving a list of network computer names using C#[^] [/edit]

[edit 2]
IPAddress[] ipAddresses = Dns.GetHostAddresses(computerName);

[/ edit 2]



'g'

[/edit 2]

'g'


我需要一个完成的代码,因为我不是编码器。如果你能在这里放一些示例代码,那就太好了。我只需要一个扫描网络运行计算机的程序,并将收集到的数据保存在文本文件中。
I need a finished code because im not a coder. It would be nice if you could put some example code in here. I just need a program that scans the network for running computers and saves the collected data in a textfile.


那你怎么做?



谢谢
How would you do it then?

Thanks


这篇关于如何在我们的网络中注册所有已打开的计算机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆