-->
Page 1 of 1

mega2560 +esp8266 get request return 200 ok miss. results

PostPosted: Fri Sep 16, 2016 10:04 am
by oded
(i passed this from general discussion)

this is a response over arduino serial i have for get request over esp8266


serial started!
68
esp_alive
there is wifi
connecting to server
there is wifi
there is server

AT+CIPSEND
Recv 68 bytes

SEND OK

+IPD,333:HTTP/1.1 200 OK
Server:������������������������������������
C



AS you can see response is fine except its truncated somehow .

the null question marks are results of 100 time loop i made to try and wait for full response.





thats my original question :-




i have mega +8266 sending get request to my server (shared server).
the get request is responded with 200 confirmation (ok) from server and returns back only partial
charachters.

the get request is fine when i run it through browser.

there should be something todo with sync. or memory clogged .


i know this is a common issue but every step i took , like adding delays , or looping read command over delays did not change anything.

my question how to "suck" the charachters issued by server fully ,

i can see that a proper amount of characters is issued but very few reach my serial.

(the esp gets its commands through AT commands i println through hardware serial1 and i print reads to hardware Serial .)


Have a great day folks :)

Re: mega2560 +esp8266 get request return 200 ok miss. result

PostPosted: Sat Sep 17, 2016 9:40 am
by oded
Solved.


the problem derived from nervous arduino serials serial (console ) and serial1 receiving fast data from server.


they dont like to work parralel and get data truncated.



Solution - mute Serial while serial1 receives passes data.

more specific :-

use Serial1.readBytesUntil() function to read entire stream or as much as you like to an array

only then process , print , convert etc.


hope this contributes something here.



here is the core of solution :-

char serialdata[100];

Serial1.readBytesUntil("Z", serialdata,100);

int _count;
String _result ="";
while (_count< 100){
_result +=String( serialdata[_count]);
_ count = _count+1; }

Serial.println("result"+_result);


thanks good w/e

oded.\