Working on USB Modem, Used RAS interface for dial/hangup.
- For connection used
RASDial()
and for disconnection usedRASHangUp()
API's. - After successful connection waiting for the disconnect event using function
RasConnectionNotification(rasHandle, event, RASCN_Disconnection)
, event notifies successfully when disconnect happens. - I need to find out the reason of disconnection, if it disconnect due to lost network signal then put my application on auto reconnect.
Is there any method or API which provides the reason for disconnection like LINK_FAILED
, USER_SWITCH
, USER_LOGOFF
... etc.
RasGetConnectStatus
API can give you the reason inRASCONNSTATUS.dwError
field.