![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Example: Http.CloseAllConnections methodSee more HTTP ExamplesDemonstrates how to call the CloseAllConnections method.
integer li_rc integer li_Success oleobject loo_Http string ls_Url oleobject loo_SbJson integer li_StatusCode li_Success = 0 loo_Http = create oleobject li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // Demonstrate ls_Url = "https://finnhub.io/api/v1/quote?symbol={$symbol}&token={$api_key}" // When the request is sent, the {$symbol} is replaced with "MSFT" // and the {$api_key} is replaced with "1234567890ABCDEF" loo_Http.SetUrlVar("symbol","MSFT") loo_Http.SetUrlVar("api_key","1234567890ABCDEF") loo_SbJson = create oleobject li_rc = loo_SbJson.ConnectToNewObject("Chilkat.StringBuilder") li_Success = loo_Http.QuickGetSb(ls_Url,loo_SbJson) if li_Success = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_SbJson return end if li_StatusCode = loo_Http.LastStatus Write-Debug loo_Http.LastResponseHeader // The response header contains this: // Date: Tue, 19 Aug 2025 12:18:56 GMT // Content-Type: application/json; charset=utf-8 // Transfer-Encoding: chunked // Connection: keep-alive // Content-Encoding: gzip // The "Connection: keep-alive" header ensures the server keeps the connection open for subsequent requests. // If the server responds with a "Connection: close" header, it indicates the connection will be closed after the response. // Consequently, Chilkat will also close the connection, requiring a new one to be established for any subsequent requests to the same server. // If your application uses the same HTTP object instance to send requests to a different server, a new connection will be established with that server. // Existing connections remain open, with Chilkat maintaining up to 10 open connections. // If all 10 connections are in use, Chilkat will close the least recently used connection to connect to a new server. // Your application can explicitly close all open connections like this: li_Success = loo_Http.CloseAllConnections() if li_Success = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_SbJson return end if Write-Debug "Success." destroy loo_Http destroy loo_SbJson |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.