Link to home
Start Free TrialLog in
Avatar of esps
esps

asked on

Convert HEX and send to port

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
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to use a BYTE array, not a char array though.