1

Working on USB Modem, Used RAS interface for dial/hangup.

  • For connection used RASDial() and for disconnection used RASHangUp() 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.

informatik01
  • 16,038
  • 10
  • 74
  • 104
Kalpesh Gedia
  • 127
  • 2
  • 8

1 Answers1

2

RasGetConnectStatus API can give you the reason in RASCONNSTATUS.dwError field.

informatik01
  • 16,038
  • 10
  • 74
  • 104
kerem
  • 2,699
  • 1
  • 32
  • 37
  • Is there a particular time which to call the API mentioned? Whenever I've tried, I always seem to get a ERROR_INVALID_HANDLE being returned from the API (on Windows 10). It's being triggered by a callback from RasConnectionNotification with RASCN_Disconnection being used. – Jeff Winn Jul 21 '20 at 11:24