I make a connection between two different host in PHP using socket function. The connected host is data server. The received data comes in binary data. In C++ i used the structure (refer sample coding below) to process the received data. I copy a packet of received data and processed it within that structure. My inquiry is How to perform the same task as in C++ program with PHP. Other thing is once the data can be interpreted, can i check each single bit of byte for digital input/output. Each bit of digital input/output need to be known since it represent one channel.
typedef struct {
int dataValid;
int numBytes;
unsigned char isolateData[ALARM_MAX_DIGITAL_INPUT/BITS_PER_BYTE];
unsigned char digitalInput[ALARM_MAX_DIGITAL_INPUT/BITS_PER_BYTE];
unsigned char digitalOutput[ALARM_MAX_DIGITAL_OUTPUT/BITS_PER_BYTE];
analogRawData analogInput[ALARM_MAX_ANALOG_INPUT],
analogOutput[ALARM_MAX_ANALOG_OUTPUT];
char unitName[MAX_STRING_LEN], // These are string parameters read from the scanPrantau
unitLocation[MAX_STRING_LEN], // configuration file
unitDescription[MAX_STRING_LEN];
unsigned char model; // These are obtained by IOcard class when it queries
unsigned char version; // a Prantau unit
unsigned short numDICards, numDIChannels;
unsigned short numDOCards, numDOChannels;
unsigned short numAICards, numAIChannels;
unsigned short numAOCards, numAOChannels;
} DUMP_DATA;