EtherCard icon indicating copy to clipboard operation
EtherCard copied to clipboard

Parsing a get query latest library

Open Daemon256 opened this issue 8 years ago • 1 comments

When parsing in the latest version of the library a simple get request, I get very strange results.

Entering the arduino get query: /-1050.76 (browser get - http://xxx.xxx.xxx.xxx/-1050.76)

The NOT OK result is that I saw arduinо in the new library:

/

1050 . 76

The sensations that the values come in different packets The OK result is that I saw arduinо in the older library: /-1050.76

Code part: word len = ether.packetReceive(); word pos = ether.packetLoop(len); if (pos) { bfill = ether.tcpOffset(); char *data = (char *) Ethernet::buffer + pos ; ether.httpServerReplyAck(); powernow = cmdparse(data); ether.httpServerReply_with_flags(bfill.position(), TCP_FLAGS_ACK_V | TCP_FLAGS_FIN_V); // send web page data }

int cmdparse(const char *cmd) {

const char *cp = cmd + 4 ;
int pin;

if (*cp++ == '/') { // если 4 символ равен слешу


    pin = atoi(cp) ;
    wdt_reset(); // говорим собаке что "В Багдаде все спокойно", начинается очередной отсчет 8 секунд.
    rst = 0;
    return pin; // возвращаем значение


}


else return -5000 ;

}

Daemon256 avatar Apr 23 '17 11:04 Daemon256

I can't think of a change that would cause this. Here are the commits if you want to look yourself: https://github.com/jcw/ethercard/commits/master

In order to really figure out the bug you will probably have to "bisect" the code, going backwards in time till the bug stops.

solarkennedy avatar Apr 23 '17 16:04 solarkennedy