Page 1 of 1

sending hex data to a socket

Posted: Tue Jun 17, 2003 11:25 am
by Mat
Hi

In VB I can send a hex value &H11FF like this:

Private Sub cmdRTS_Click()
If statRTS = True Then cmd = &H10FF Else cmd = &H11FF
Winsock1.SendData cmd
End Sub

But in PHP can't seem to send the hex value. It seems that the data sent to the socket needs to be a string:

$socket = socket_create(AF_INET, SOCK_STREAM, 0);
$result = socket_connect($socket, $host, $port);
socket_write($socket, "0x11FF")
etc..

Any Ideas on how I can send this hex value 0x11FF to the socket in PHP?

Thanks, Mat