Sample code for 30+ languages & platforms
PureBasic

Clear the DNS Cache

See more Socket/SSL/TLS Examples

Demonstrates Socket.DnsCacheClear, which clears Chilkat's process-wide in-memory DNS cache so subsequent hostname resolutions perform a new lookup.

Background. The cache is shared by Chilkat objects in the process, so clearing it affects subsequent lookups across the application.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkSocket.pb"

Procedure ChilkatExample()

    socket.i = CkSocket::ckCreate()
    If socket.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ;  Clear Chilkat's process-wide in-memory DNS cache.  Subsequent hostname resolutions perform a new
    ;  lookup as needed.  The cache is shared by Chilkat objects in the process.
    CkSocket::ckDnsCacheClear(socket)
    Debug "DNS cache cleared."


    CkSocket::ckDispose(socket)


    ProcedureReturn
EndProcedure