[En-Nut-Discussion] Sending Numerical Data
MUHAMMAD AZEEM AZAM
muhammadazeemazam786 at yahoo.com
Thu Feb 1 09:31:55 CET 2007
hi
I have to send more than 128 BYtes of Data but in the form of 128 Bytes chunk.
The first 2 Bytes show the packet number.
in the first 2 Bytes how can i reach upto from counting packets 0-65536.
2power16 = 6536
how is that possible
bye
"Thiago A. Corrêa" <thiago.correa at gmail.com> wrote:
Muhammad,
Yeah, it appears that you are sending in ASCII. Althought I don't
understand your code. To use the binary value just dont enclose it with ' or
". Sorry I can't be of further assistance but I can't make much sense of
what the problem is.
Cheers.
On 1/31/07, MUHAMMAD AZEEM AZAM wrote:
>
> Hi
>
> I have to send now more than 128 Bytes of Data. (1 Packet = 128 BYtes)
> The first two Bytes are numerical Numbers that shows tha packet.
> The code below (Please if u can make it better then it would be helpful)
> its working and showing numbers from 0 t0 99.
> But i think its in ASCII Format.
> 1) How can i send in Binary.
> 2) Since 2-Bytes so i need nos from 0 to 65536.
> hows that possible
> ------------------------------------------------------
> unsigned int packet_number_L = '0';
> unsigned char packet_number_R = '0';
> ---------------------------------------------------------
> its the part of main()
>
> if (strncmp(buff, "packet\n", got_data) == 0) //If Match
>
> {
> int p_size = 128;
> char p_array[p_size];
> int index = 0;
>
> p_array[0]= packet_number_L;
> p_array[1]= packet_number_R;
>
> for(index=2;index
> {
> p_array[index] = rand()%26+'a';
> }
>
> fwrite(p_array,sizeof(p_array),1,TCPStream);
>
>
> if(packet_number_R == 57)
> {
> packet_number_R = '0';
> packet_number_L++;
> }
> else
> {
> packet_number_R ++;
> }
>
> if(packet_number_R == 57 && packet_number_L ==57)
> {
> packet_number_R = '0';
> packet_number_L = '0';
> }
>
> continue;
> }
> ------------------------------------
>
>
> ---------------------------------
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion
---------------------------------
Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
More information about the En-Nut-Discussion
mailing list