[En-Nut-Discussion] Sending Numerical Data

Thiago A. Corrêa thiago.correa at gmail.com
Wed Jan 31 23:47:30 CET 2007


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 <muhammadazeemazam786 at yahoo.com> 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_size;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
>



More information about the En-Nut-Discussion mailing list