网络是否连接?

 

 

 

 

IsNetworkAlive Function

IsNetworkAlive Function

 

The IsNetworkAlive function determines whether or not a local system is connected to a network, and identifies the type of network connection, for example, a LAN, WAN, or both.

 

Bool IsNetworkAlive(
  __out         LPDWORD lpdwFlags


);
Parameters
lpdwFlags

The type of network connection that is available. This parameter can be one of the following values:

 

NETWORK_ALIVE_LAN

The computer has one or more LAN cards that are active.

NETWORK_ALIVE_WAN

The computer has one or more active RAS connections.

NETWORK_ALIVE_AOL

This flag is only valid in Windows Me/98/95.

Indicates a computer is connected to the America Online (AOL) network.

Return Value

This function returns one of the following values:

Return codeDescription

TRUE

A local system is connected to a network.

For information about the type of connection, see the lpdwFlags parameter.

FALSE

There is no connection.

For extended error information, call GetLastError .

Remarks

This function can be used by an application to determine whether or not there is network connectivity before proceeding with network operations. A directory service type of application, e-mail client, or Internet browser can adapt to various types of network connectivity. For example, a printing operation can be deferred until a network connection is available.

It may not always be practical for an application to call IsNetworkAlive to determine whether or not a local system is disconnected from a LAN, because IsNetworkAlive can be slow, and it may take too much time for the function to detect that a local system is disconnected. However, IsNetworkAlive can always identify a WAN connectivity at the moment.

Note   This function is only available for TCP/IP connections.

另外:可以看一下这里:

http://blog.csdn.net/nitghost/archive/2009/02/08/3868439.aspx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值