the reason of net.socket:send("payload") issue.
Posted: Thu Jan 08, 2015 12:44 am
In the firmware build after 20141219.
where SDK 0.9.4 and 0.9.5 are adopted.
multiple lines of
net.socket:send("hello\n")
net.socket:send("world\n")
net.socket:send("third line\n")
will NOT act as is.
probably only the first line ("hello") was sent.
the reason is due to the change in SDK file, lwip/app/espconn.c:
0.9.4 & 0.9.5: line 275.
0.9.2: line 252
this code means, only when the previous send() is done(inside sent callback is triggered).
the next send will take effect. otherwise, espconn_tcp_sent will not called.
so, the solution maybe:
1, roll back to 0.9.2, if data send with big chunk is called too fast. some data lost(overwritten).
2, call send when the previous send is done.
3, use a block send(), return when previous send is done. (may cause watchdog issue, if data is huge.)
any ideas?
where SDK 0.9.4 and 0.9.5 are adopted.
multiple lines of
net.socket:send("hello\n")
net.socket:send("world\n")
net.socket:send("third line\n")
will NOT act as is.
probably only the first line ("hello") was sent.
the reason is due to the change in SDK file, lwip/app/espconn.c:
0.9.4 & 0.9.5: line 275.
Code: Select all
case ESPCONN_TCP:
if (value && (pnode->pcommon.write_len == pnode->pcommon.write_total)){ // this line cause the issue
espconn_tcp_sent(pnode, psent, length);
}else
return ESPCONN_ARG;
break;
case ESPCONN_UDP: {
if (value)
espconn_udp_sent(pnode, psent, length);
else
return ESPCONN_ARG;
break;
}
0.9.2: line 252
Code: Select all
case ESPCONN_TCP:
if (value) // diff here
espconn_tcp_sent(pnode, psent, length);
else
return ESPCONN_ARG;
break;
case ESPCONN_UDP: {
if (value)
espconn_udp_sent(pnode, psent, length);
else
return ESPCONN_ARG;
break;
}
this code means, only when the previous send() is done(inside sent callback is triggered).
the next send will take effect. otherwise, espconn_tcp_sent will not called.
so, the solution maybe:
1, roll back to 0.9.2, if data send with big chunk is called too fast. some data lost(overwritten).
2, call send when the previous send is done.
3, use a block send(), return when previous send is done. (may cause watchdog issue, if data is huge.)
any ideas?