-->
Page 1 of 1

TCPERVER refused connection

PostPosted: Mon Nov 16, 2015 12:20 pm
by Ghil
Hello,
I have a Esp8266-01 (on Arduino Mega) which works fine with an android application. My problem is that after a few minutes of inactivity, the TCPServer refuse connection ... Android debugger said "failed to connect to /192.168.43.1 (port 80): connect failed: ECONNREFUSED (Connection refused)"
I tried to change the port number, but still failed. As everything starts to work fine when I reset the Arduino, is the esp8266 triggers deep sleep and how to wake up?
Thank you for your help

Re: TCPERVER refused connection

PostPosted: Mon Nov 16, 2015 1:05 pm
by inx
Hi.

I don't think the esp goes to sleep automatically. usually you would tell it to sleep:
Code: Select allvoid system_deep_sleep(uint32 time_in_us);


you could observe whats happening and printout some status information (client connects etc...) over the serial.

if you suspect it is sleeping you could also check the wifi sleep_status like this:
Code: Select allenum sleep_type wifi_get_sleep_type(void);


to directly call SDK functions have a look at the CallSDKFunctions example.