sending hex data to a socket

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mat
Forum Newbie
Posts: 1
Joined: Tue Jun 17, 2003 11:25 am

sending hex data to a socket

Post 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
Post Reply