I am working on webGUI for networking application.There are around 30 to 35 network related parameters user would enter by PHP forms.
I already have PHP page and I can print all this parameters entered by user in PHP script.
I have another process running on same system (Linux) and uses socket to receive data from PHP script. Here is the sample code
// PHP code
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)
socket_bind($sock, "127.0.0.1", 1000);
$msg_code =0xc010;
$msg_len = 0x10;
$msg_data = 0xa0b012cc;
$msg = $msg_code
$msg .= $msg_len
$msg .= $msg_data
socket_write($msgsock, $msg, strlen($msg);
// C code user process
// User process written in C has following structure where I want to parse and use the data sent by PHP
// I want to map incoming data with this internal structure
{
ushort msg_code;
uchar msg_len;
unsigned long msg_data
}struct
My local process is receiving the data sent by PHP script but it is not in hex.
For e.g if I send 0xC0 from php then I receive 02 00
if I send 0xb2 from php then I receive 01 02
I just want packed hex data so that I can co related with my internal structure in the context of my local user process.
Can anybody help me how I can do this or am I missing anything?.
Thanks in Advance
Saj