Skip to content

Cannot use http post method with ethernet.client when ariadne ethernet.reset in use #21

Open
@loathingKernel

Description

@loathingKernel

From @PhilFluffy on February 10, 2017 7:33

Hi thanks for reading this, I know its been a while since a release, but this bootloader is so useful to me I hope its not just left in a sunset phase now.
I'm trying to use ariadne with its ethernet reset server alongside my sketch for some home automation equipment (saves massively and avoids laptops up ladders to update my controllers in odd locations). One of the tasks that does is send out a http POST to a remote home-assistant automation server with a JSON formatted string so it can keep the master house gui in sync with all the nodes.

When I enable reset.check in the main loop, the following code stops working

if (jsonclient.connect(Configuration.extJsonServer, Configuration.extJsonServerPort)) {
  // Make a HTTP JSON request:
  mylocalJsonData = (F("POST /api/states/switch."));
  Serial.print (F("inner loop json data is "));Serial.print (String(mylocalJsonData)+ "\n");
} else { Serial.print ("Error :- "+String(jsonclient)+ "\n");}

In the serial log I see this
" Error :- 0"
Error code zero indicating failed connection of course. And it also doesn't send the packets out the interface at all on tcpdump output.
My sketch has 2 other ethernet services which function fine, (udp for ntp client, and ethernet server listening on port 80 http use in my sketch which uses GET requests) so it seems its just the outbound POST from my arduino ethernet tcp as a client affected.

If I comment out reset.check(); in the main loop, the json POST starts working. It has to be a POST to authenticate to the remote server in the JSON headers.

I read a post from a few years ago from Stelios Tsampas where he was discussing how to work around a similar sounding issue, is it documented somewhere and this issue now solved?
http://developers.arduino.narkive.com/m4JMgDNs/remotely-resetting-an-arduino

As a workaround, I already have a authenticated section in my configuration web gui, can I call a reset method from that instead of running a whole daemon on a higher port with a check in the main loop just for the reset? I already have a function that calls the following to do a soft reset after updating network config in eeprom, I could just expand that out if so.
asm volatile (" jmp 0");

Copied from original issue: codebndr#37

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions