You are here: PHP:Socket binary message to c-server « PHP Programming Language « IT news, forums, messages
PHP:Socket binary message to c-server

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация