Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Send Bytes over SocketDemonstrates how to send bytes over a TCP/IP socket.
Dim socket As New Chilkat.Socket() Dim success As Boolean success = socket.UnlockComponent("Anything for 30-day trial") If (success <> true) Then MsgBox("Failed to unlock component") Exit Sub End If ' Connect to some custom server at some host:port that is expecting ' to accept the connection and receive the data. Dim ssl As Boolean ssl = false Dim maxWaitMillisec As Long maxWaitMillisec = 20000 Dim port As Long port = 4410 success = socket.Connect("www.some-hostname.com",port,ssl,maxWaitMillisec) If (success <> true) Then MsgBox(socket.LastErrorText) Exit Sub End If ' Set maximum timeouts for reading an writing (in millisec) socket.MaxReadIdleMs = 10000 socket.MaxSendIdleMs = 10000 Dim byteData() As Byte = {&HFF,&H55,&HAA,0} ' Send the byte data. success = socket.SendBytes(byteData) If (success <> true) Then MsgBox(socket.LastErrorText) Exit Sub End If ' Close the connection with the server ' Wait a max of 20 seconds (20000 millsec) socket.Close(20000) |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.