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.
Chilkat.Socket socket = new Chilkat.Socket(); bool success; success = socket.UnlockComponent("Anything for 30-day trial"); if (success != true) { MessageBox.Show("Failed to unlock component"); return; } // Connect to some custom server at some host:port that is expecting // to accept the connection and receive the data. bool ssl; ssl = false; int maxWaitMillisec; maxWaitMillisec = 20000; int port; port = 4410; success = socket.Connect("www.some-hostname.com",port,ssl,maxWaitMillisec); if (success != true) { MessageBox.Show(socket.LastErrorText); return; } // Set maximum timeouts for reading an writing (in millisec) socket.MaxReadIdleMs = 10000; socket.MaxSendIdleMs = 10000; byte[] byteData = { 0xFF, 0x55, 0xAA, 0}; // Send the byte data. success = socket.SendBytes(byteData); if (success != true) { MessageBox.Show(socket.LastErrorText); return; } // 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.