C# Check Remote Server

后端 未结 5 1845
没有蜡笔的小新
没有蜡笔的小新 2020-12-15 06:18

Can anyone advise what the best way to check (using .NET 3.5) if a remote server is available?

I was thinking of using the following code but would like to know if

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-15 07:01

    You could ping it

    You could download the default page from it

    You could do a HEAD request

    If it's a local IIS6 server on your network, and you have some admin details, you could connect to IIS using some DirectoryEntry code

    Some of the answers on 136615 might help too, specifically the accepted answer that talks about sockets

    For the print servers (or, specifically, the printers), the code by K Scott here might help. It's fun code to play with anyway :-) That code mentions dns.resolve, which is obsoleted and replaced by Dns.GetHostEntry

    I'm about out of ideas :-)

提交回复
热议问题