Posted by scallst on 11/18/92 11:43
Hi!
I'm new in PHP and I have a problem on sending a socket message to
c-server. I am able to connect using socket_connect but my problem is I
have to setup TCP message in a special format as my c-server is
expacting it in as in c-Structure byte order with binary data.
For example: at server:
typedef struct
{ unsigned char msg;
unsigned char start;
unsigned char nCont;
unsigned char nError;
unsigned char nFunction;
unsigned short nRecLen;
unsigned char nData[900];
unsinged char msg1;
unsigned char end ;
} MyMsg;
where nData coulde be in format like:
struct {
int myid;
char Name[100];
char Name2[100];
int Type;
int Working;
int Alarm;
int Auto;
char num[20];
}
How should I setup my string in PHP that can fit in c-byte order like
unsinged short-2 byte, int-4-byte binary number and then character
string.
Thank you in advance.
Scall
Navigation:
[Reply to this message]
|