Thanks very much for the paper. It was really helpful.
Now I can receive from the SF. However, what I receive is unexpected. First,
what is the platform that I have to send to the SF? At the moment I resend
the platform that I receive from the SF. Second, the data length byte is
always '\t' which leads to wrong readings. Following is my code:
char s[2];

char dataLen[1];

char packet[256];

char platform[4];

int rcd;

short data;

short len;


if ((rcd = recv(sd, s, 2, 0)) != 0)

{

       send(sd, s, 2, 0);

       rcd = recv(sd, platform, 4, 0);    //reads 4 bytes

       send(sd, platform, 4, 0);    //send the platform that I received


       rcd = recv(sd, dataLen, 1, 0);    //dataLen is always '\t'

       sscanf(dataLen, "%d", &len); //wrong len

       printf("%d\n", len);


       rcd = recv(sd, packet, len, 0);    //read wrong data

       sscanf(packet, "%d", &data); //read the first byte

       printf("%d\n", data);


}


I also found this article about the SF protocol:
http://www.stanza.co.uk/emergentcity/?cat=11

Regards
Islam Hegazy

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to