I am trying to send data via TCP.
Some data as to be sent in HEX format while some data doesn't.
Here is an example string whats in brackets should be in HEX:
Please advise how to send this data properly.
Here is the code:
postData = "\x00\x81SV.97000000009\x1C123456";
var server = "localhost";
var port = 5100;
TcpClient client = new TcpClient(server, port);
byte bytes = Encoding.ASCII.GetBytes(postData);
NetworkStream stream = client.GetStream();
stream.Write(bytes, 0, bytes.Length);
bytes = new Byte;
String responseData = String.Empty;
Int32 data = stream.Read(bytes, 0, bytes.Length);
responseData = Encoding.ASCII.GetString(bytes, 0, data);
var result = responseData;