Hi,
when I used the sample code , the server side could receive the request but nothing responded;
I found out this section would cause directly return without result
if (data.toString().indexOf('\n') == -1) {
// 沒收到換行字元,代表命令還沒全部傳送完成
return;
}
I just deleted it and got success result.
By the way, what is the purpose of using
var cmdStr = '';
cmdStr += data.toString();
I deleted it and it still worked.
Thanks.