0

I am using RasDial API inside an MFC application. It turns out that API returns always 633 (The Port Is in Use or Not Configured) while the same code works fine in a command line application.

Here is the code snippet

    RASDIALPARAMS rdParams;
    ZeroMemory(&rdParams, sizeof(RASDIALPARAMS));
    rdParams.dwSize = sizeof(RASDIALPARAMS);
    _tcscpy(rdParams.szEntryName, TEXT("VPN"));
    m_hRasConn = 0;
    DWORD dwRet = RasDial( NULL, NULL, &rdParams, 1, NULL, &m_hRasConn);

The phone book entry for VPN is perfect, it works always when I manually connect and also when I use rasdial.exe The same entry can be dialed when I use above code inside a command line application but never works when I use it inside MFC application.

Any idea what could go wrong?

1 Answer 1

0

From what I can tell, your call to RasDial looks fine.

I remember having this problem during initial development of DotRas. If it's what I'm thinking, if you're testing your application and close the application while a connection attempt is in progress, the RAS state machine gets confused and the connection is left open until you restart (pretty much all versions of Windows pre-Windows 8 exhibit this behavior) the machine.

What this means is, once you start a connection, do not close your application unless you call RasHangUp on the handle that RasDial returned to you if it hasn't finished connecting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.