How to get data through http from web server?


hi ,
i using arduino uno , wifi shielf. use wifi library , wificlient library build http client.
i trying download data web server. did not sample how use httprequest download file , transmit hex. file text full of hex data. code this. not  steady enough. sometime stop before data. 5808 bytes. please give me help. thanks.
code: [select]
      httprequest();
      uint16_t no0xdata_sign=0;
      uint8_t body_sign=0;   
      uint8_t body_finish_sign=0;
      uint8_t high=0;
      uint8_t low=0;
      while(connect_sign==0)
      {
        while (client.available())
        {
          uint8_t c = client.read();
          if(0xd==c&&client.read()==0xa)
          {
            c = client.read();
            if(c==0xd&&client.read()==0xa)
            {
              uint8_t body_sign=1;
              serial.println("start downloading file");
              while(body_sign==1)
              {         
                c=client.read();
                if (0x30 == c && 0x78 == client.read())
                {
                  bytes_send+=1;
                  uint8_t d = client.read();
                  if (d >= '0' && d <= '9') {
                    high= d - '0';
                  } else if (d >= 'a' && d <= 'f') {
                    high= d - 'a' + 10;
                  } else if (d >= 'a' && d <= 'f') {
                    high= d - 'a' + 10;
                  } else {
                    high= -1;   
                  }
                  d = client.read();
                  if (d >= '0' && d <= '9') {
                    low= d - '0';
                  } else if (d >= 'a' && d <= 'f') {
                    low= d - 'a' + 10;
                  } else if (d >= 'a' && d <= 'f') {
                    low= d - 'a' + 10;
                  } else {
                    low= -1;   
                  }       
                  serial_rx_data[number_buffer+1]=(high*16) + low;;
                  serial.print(serial_rx_data[number_buffer+1]);                 
                  if(bytes_send==5808)
                  {
                    serial.println("finished");
                    body_sign=0;
                    body_finish_sign=1;
                    bytes_send=0;
                    connect_sign=1;
                    break;
                  }
                  else{
                    }
                }else{
                }
              }
            }
          }
        } 
      }
    }

this not complete sketch, don't waste our time code snippets.

5908 bytes? know uno has 2kb of ram in total?

"wifi shield" let me expect you're talking arduino wifi shield , not of other wifi shields available. correct?


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > How to get data through http from web server?


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support