TCP/IP client example in JScript; how to send HEX values in bytearray?
Hi,
I really appreciate the TCP/IP Client script example for JScript found on the TestComplete site but I face to some difficulites to change the type of value to be sent.
My purpose of this script is to connect to an IP relay module and activate some relays on different test states (Start of tests, Error(s) or warning(s) in logs, etc), which they activate "production line " style lights to have a real-time satus of test runs.
As I see here:
binaryData = dotNET.System_Text.Encoding.ASCII.GetBytes_2("TestMessage");
The binaryData variable is an "object" containing the bytearray of the string "TestMessage"
In my use case, I want to be able to send a byte array of HEX values. Ex: [58, 01, 11, 00, 00, 00, 01, 69]
I tried some ways to convert string into Hex and then into a bytearray but it never works....
Since I code in VB.net, I have some difficulties to figure how to do it in Jscript. And since I cannot change the scripting language of project (already in JScript), I need to make it works using JScript.
Thanks a lot for your help!
Hi Francis,
The code you are trying (DLL.DefineDLL() ...) is for native unmanaged DLLs.
As your DLL is the managed one, you should add it to the CLR Bridge in TestComplete and call using dotNet object (http://support.smartbear.com/testcomplete/docs/testing-with/advanced/using-external-functions/calling-from-dotnet-assemblies.html).