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
(DataFlex) Send Bytes on a Socket ConnectionDemonstrates how to send a mixture of binary (non-text) and text bytes on a socket connection.
Use ChilkatAx-win32.pkg Procedure Test Handle hoSocket Boolean iSsl Integer iMaxWaitMillisec Integer iPort Boolean iSuccess Variant vBd Handle hoBd String sTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatSocket)) To hoSocket If (Not(IsComObjectCreated(hoSocket))) Begin Send CreateComObject of hoSocket End // Connect to some host:port Move False To iSsl Move 20000 To iMaxWaitMillisec Move 5555 To iPort Get ComConnect Of hoSocket "test.com" iPort iSsl iMaxWaitMillisec To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoSocket To sTemp1 Showln sTemp1 Procedure_Return End // We wish to send a 0x00 byte followed by the us-ascii string "10800" Get Create (RefClass(cComChilkatBinData)) To hoBd If (Not(IsComObjectCreated(hoBd))) Begin Send CreateComObject of hoBd End Get ComAppendByte Of hoBd 0 To iSuccess Get ComAppendString Of hoBd "10800" "utf-8" To iSuccess // Send the entire contents of bd. Get pvComObject of hoBd to vBd Get ComSendBd Of hoSocket vBd 0 0 To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoSocket To sTemp1 Showln sTemp1 Procedure_Return End End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.