c++ 局域网连接有关问题

c++ 局域网连接问题
现在我要做一个这样的程序
在一个局域网类,有一台2003的服务器
在这一个局域网内的一台PC上,如果网络一通,就要马上拷贝文件到服务器,
所以现在我首先要做的是扑捉这台机器和服务器连通的消息,以便启动拷贝程序
对于这个我现在实现的方法是设置一个Timer,不停的去判断网络是不是通的
判断通不通的方法是不停的ping 服务器。
现在我想知道有没有更好的方法,不用ping,就知道PC与服务器的连接状态。
另外有没有更好的方法,不需要Timer就可以朴捉网络的状态信息。?
(急)
请高手帮帮忙
谢谢

------解决方案--------------------
1.IsNetworkAlive
2.可用用do{}While(true)循环代替Timer;
------解决方案--------------------
你的服务器是TCP服务器还是UDP服务器还是FTP服务器还是共享目录服务。。。?
用COPYFILE拷贝文件。。。你使用映射网络驱动器的方式?
--------------------------------------------------------
Platform SDK: Synchronization Manager

IsNetworkAlive

The IsNetworkAlive function determines whether the local system is connected to a network and the type of network connection. For example, whether the local system has connectivity to a LAN, WAN, or both networks.


Bool IsNetworkAlive(
LPDWORD lpdwFlags
);

Parameters
lpdwFlags 
[in] Provides information on the type of network connection available when the return value is TRUE. The flags can be: 

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 95 and Windows 98. Indicates the computer is connected to the America Online network. 
Return Values
TRUE 
The local system is connected to a network. 
FALSE 
Call GetLastError to determine the reason for no connectivity. 
Remarks
This function can be used by applications to determine whether there is network connectivity before proceeding with network operations. Applications such as directory service applications, e-mail clients, or Internet browsers can adapt to various types of network connectivity. For example, a printing operation can be deferred until the network connection is available.

Note it may not always be practical for applications to call IsNetworkAlive to determine whether the local system is currently disconnected from a LAN. In this case, IsNetworkAlive can be slow, and it may take too much time for the function to detect that the local system has become disconnected. IsNetworkAlive is always able to tell you if there is WAN connectivity at the moment.

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

Requirements
Client: Requires Windows XP, Windows 2000 Professional, or Windows Me.
Server: Requires Windows Server 2003 or Windows 2000 Server.
Redistributable: Requires Internet Explorer 5 or later on Windows NT 4.0 and Windows 98/95.
Header: Declared in Sensapi.h.
Library: Use Sensapi.lib.