none
Flush DNS cache RRS feed

All replies

  • Yeah, would like to know that too.
    Or how to do it manually without restarting my device. Where does the damn thing live?
    Best of all would be if MS fixed that damn bug with not clearing the cache when the device disconnects from ActiveSync, but I can live with an app of my own.

    Saturday, October 20, 2007 8:19 AM
  • The resolver cache is maintained in memory. Try the following code to flush it manually:

     

    Code Block

    extern "C" int WsControl(

    DWORD protocol,

    DWORD action,

    LPVOID pRequestInfo,

    LPDWORD pcbRequestInfoLen,

    LPVOID pResponseInfo,

    LPDWORD pcbResponseInfoLen

    );

    #define WSCNTL_AFD_FLUSH_RESOLVER_CACHE 0x00000006

     

    ....

    WSADATA wsd = {0};

    int ret = WSAStartup(2, &wsd);

    ret = WsControl(-1, WSCNTL_AFD_FLUSH_RESOLVER_CACHE, NULL, NULL, NULL, NULL);

    WSACleanup();

    return 0;

     

     

    Link winsock.lib to resolve external references
    Saturday, October 20, 2007 10:15 PM
  • This is what I'm about to try based on the ipconfig /flushdns command ...

       WSADATA WsaData;
       if (WSAStartup(MAKEWORD(1,1), &WsaData) != 0)
       {
          OutputMessage(TEXT("WSAStartup failed (error %ld)\n"), GetLastError());
          return 0;
       }
       FlushDNSCache();
       WSACleanup();

    void FlushDNSCache(void)
    {
        WSAControl(-1, WSCNTL_FLUSH_NAME_RESOLVER_CACHE, NULL, NULL, NULL, NULL);
    }

     

    Thursday, September 15, 2011 9:10 AM