Solution: TWedge provides the function WriteToDevice () for this purpose. WriteToDevice () accepts two parameters:
- The first one specifies the data which should be sent to the device.
- The second parameter specifies the timeout (in milliseconds) for this operation.
The following example sends two lines of text: The first line prompts the device for accepting the username, the second line sends the username. Each line is terminated by a newline character (\n line feed):
WriteToDevice ("user\n", 1000);
WriteToDevice ("sysadmin\n", 1000);
- Integer WriteData (Array arrData, Integer nTimeout)
- Integer WriteData (String sData, Integer nTimeout, String sEncoding = "Latin1")
The following example sends data one time as binary array and one time as string. Inside of a string you can encode a line feed with the escape sequence \n:
var arrSend = [0x48, 0x65, 0x6c, 0x6c, 0x6f];
hConn.WriteData (arrSend, 200);
hConn.WriteData ("Hello\n", 1000);
is the actual connection object.