0
我有獲取請求,並給了我它的值的請求應該在C#十六進制格式,你可以在圖片中看到的傳感器:字符串或字節轉換爲十六進制十進制在C#
我的要求,我在textbox
輸入是這樣的:"000100020005030190000212BD"
但你可以看到六角checkbox
檢查,並將其轉換我的要求hex
我該怎麼辦呢? 這裏是我的代碼,發送請求「
var listener = new TcpListener(IPAddress.Any, 3000);
listener.Start();
using (var client = listener.AcceptTcpClient())
using (var stream = client.GetStream())
{
// build a request to send to sensor
var request = new byte[2048];
stream.Write(request, 0, request.Length);
// read a response from sensor;
// note, that respose colud be broken into several parts;
// you should determine, when reading is complete, according to the protocol for the sensor
while (true)
{
// stream.Read calls here
}
}
數據表: