Sample code for 30+ languages & platforms
SQL Server

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 SQL Server Downloads

SQL Server
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @socket int
    EXEC @hr = sp_OACreate 'Chilkat.Socket', @socket OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    --  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.
    EXEC sp_OAMethod @socket, 'DnsCacheClear', NULL

    PRINT 'DNS cache cleared.'

    EXEC @hr = sp_OADestroy @socket


END
GO