netconns contra sockets in wifi:bcn_timeout

Dig Kleppe
Posts: 26
Joined: Wed Jun 28, 2017 5:03 pm

netconns contra sockets in wifi:bcn_timeout

Postby Dig Kleppe » Sat Nov 04, 2017 6:24 pm

I ( and others) have problems that after a number of messages "wifi: bcn_timout,ap_probe_send_start" appears and the connection is closed.
(see post viewtopic.php?f=13&t=3451)
A second problem is that the only way to reconnect is to reboot.
see https://github.com/espressif/arduino-esp32/issues/653
I noticed that when i use sockets the timeout happens after about 60 messages.
Using netconns it keeps running for more than 2700 messages.
What causes this difference?
I included my eclipse (non arduino) project, with the website build in. Every 50ms a CGI request is made. The latest idf is used, older idfs have the same problem.
It can be configured for netcons/ sockets with the define "NETCONS" in httpserver.c
Dig
Attachments
Webserver.zip
(137.62 KiB) Downloaded 532 times

Dig Kleppe
Posts: 26
Joined: Wed Jun 28, 2017 5:03 pm

Re: netconns contra sockets in wifi:bcn_timeout

Postby Dig Kleppe » Tue Nov 07, 2017 7:44 pm

Just to be sure that the problem is not caused by some stupid error I excluded all my other stuff and made a simple echo server:

Code: Select all

void HTTPServerTask(void *pvParameters) {
	struct netconn *conn, *newconn;
	err_t err = ERR_OK;
	struct netbuf *inbuf;
	char *buf;
	u16_t buflen;

	while (1) {

		while (!gotIP || !isConnected)
			vTaskDelay(10);

		printf("opening netcon\n");
		conn = netconn_new(NETCONN_TCP);
		netconn_bind(conn, NULL, 80);
		netconn_listen(conn);
		do {
			err = netconn_accept(conn, &newconn);
			if (err == ERR_OK) {
				err = netconn_recv(newconn, &inbuf);
				if (err == ERR_OK) {
					netbuf_data(inbuf, (void**) &buf, &buflen);
					err = netconn_write(newconn, buf, buflen, NETCONN_NOCOPY);
					netbuf_delete(inbuf);
				}
				netconn_delete(newconn);
				cntr++;
				printf("%d\n", cntr);
			}
		} while (err == ERR_OK);
		netconn_close(conn);
		netconn_delete(conn);
		vTaskDelay(1);
		printf("error netcon %d\n", err );
	}
}
With a continuous sending client the connection dies after 2644 ( very short) messages.
Dig

Dig Kleppe
Posts: 26
Joined: Wed Jun 28, 2017 5:03 pm

Re: netconns contra sockets in wifi:bcn_timeout

Postby Dig Kleppe » Tue Dec 05, 2017 7:31 pm

This post answers my timeout issue:
https://github.com/espressif/esp-idf/issues/784
Add a netconn_free after netconn_delete().

Who is online

Users browsing this forum: No registered users and 74 guests