Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Send Bytes on a Socket ConnectionDemonstrates how to send a mixture of binary (non-text) and text bytes on a socket connection.
integer li_rc oleobject loo_Socket integer li_Ssl integer li_MaxWaitMillisec integer li_Port integer li_Success oleobject loo_Bd // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Socket = create oleobject // Use "Chilkat_9_5_0.Socket" for versions of Chilkat < 10.0.0 li_rc = loo_Socket.ConnectToNewObject("Chilkat.Socket") if li_rc < 0 then destroy loo_Socket MessageBox("Error","Connecting to COM object failed") return end if // Connect to some host:port li_Ssl = 0 li_MaxWaitMillisec = 20000 li_Port = 5555 li_Success = loo_Socket.Connect("test.com",li_Port,li_Ssl,li_MaxWaitMillisec) if li_Success <> 1 then Write-Debug loo_Socket.LastErrorText destroy loo_Socket return end if // We wish to send a 0x00 byte followed by the us-ascii string "10800" loo_Bd = create oleobject // Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0 li_rc = loo_Bd.ConnectToNewObject("Chilkat.BinData") loo_Bd.AppendByte(0) loo_Bd.AppendString("10800","utf-8") // Send the entire contents of bd. li_Success = loo_Socket.SendBd(loo_Bd,0,0) if li_Success <> 1 then Write-Debug loo_Socket.LastErrorText destroy loo_Socket destroy loo_Bd return end if destroy loo_Socket destroy loo_Bd |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.