PowerBuilder Requires Chilkat v11.6.0+
PowerBuilder
Configure MCP Connection Settings
See more MCP Client Examples
Demonstrates Mcp.SetConnectionSettings, which copies connection settings -- such as an HTTP proxy, SOCKS proxy, bind IP address, and TLS options -- from a Socket and applies them before connecting.
Background. This is optional; if not used, a direct connection is made. It is useful when the MCP server must be reached through a proxy or with specific TLS settings.
Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Mcp
oleobject loo_Sock
li_Success = 0
loo_Mcp = create oleobject
li_rc = loo_Mcp.ConnectToNewObject("Chilkat.Mcp")
if li_rc < 0 then
destroy loo_Mcp
MessageBox("Error","Connecting to COM object failed")
return
end if
// Configure connection settings on a Socket -- such as an HTTP proxy, SOCKS proxy, bind IP address,
// or TLS options -- and apply them to the MCP client before connecting. This is optional; if not
// used, a direct connection is made.
loo_Sock = create oleobject
li_rc = loo_Sock.ConnectToNewObject("Chilkat.Socket")
loo_Sock.HttpProxyHostname = "proxy.example.com"
loo_Sock.HttpProxyPort = 8080
li_Success = loo_Mcp.SetConnectionSettings(loo_Sock)
if li_Success = 0 then
Write-Debug loo_Mcp.LastErrorText
destroy loo_Mcp
destroy loo_Sock
return
end if
li_Success = loo_Mcp.Connect("https://learn.microsoft.com/api/mcp")
if li_Success = 0 then
Write-Debug loo_Mcp.LastErrorText
destroy loo_Mcp
destroy loo_Sock
return
end if
Write-Debug "Connected using the configured connection settings."
destroy loo_Mcp
destroy loo_Sock