We help IT Professionals succeed at work.

Convert HEX and send to port

esps
esps asked
on
Hi Experts,
I need to do a conversion of the equivalent Hex Value of a string.
This implies that my 'string':
55 01 00 01 00 01 00 E1 FF 01 00 61 61 61 61 61 61 61 61 61 61 61 61 70 06 AA
is allready the actual HEX which I want to define as:
unsigned char buffer[24] = { 0x55, 0x00, 0x03, 0x00, 0x05, 0x00, 0x01, 0xE1, 0x01, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x70, 0x06, 0xAA }
AS Char, the first value will typically be "U"
I then need to send the buffer to a port using:

 Dim serverStream As NetworkStream = clientSocket.GetStream()
 serverStream.Flush()
WOuld appreciate some help to code this correctly or a link please
regards
Comment
Watch Question

Most Valuable Expert 2012
Top Expert 2014
Commented:
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009

Commented:
You need to use a BYTE array, not a char array though.