我有以下代码:
$send1 = 0x01;
$send2 = 0x03;
$send3 = 0x00;
$send4 = 0x00;
我这样发送:
socket_write($spawn, $send1, strlen ($send1)) or die("Could not write output\n");
socket_write($spawn, $send2, strlen ($send2)) or die("Could not write output\n");
socket_write($spawn, $send3, strlen ($send3)) or die("Could not write output\n");
socket_write($spawn, $send4, strlen ($send4)) or die("Could not write output\n");
接收方得到它是这样的:
$result = socket_read ($socket, 1024) or die("Could not read server response\n");
echo "Reply From Server :".$result;
收到的数据是:1300
,如何在php中使用套接字发送和接收十六进制?