Set active connection
@@ -257,6 +257,11 @@ espi_parse_ciprecvdata(const char* str) {
/* Check data length */
conn = espi_parse_number(&str); /* Parse connection ID */
+ if (conn < ESP_CFG_MAX_CONNS) {
+ esp.m.ipd.conn = &esp.m.conns[conn]; /* Set connection */
+ } else {
+ return espERR;
+ }
if ((len = espi_parse_number(&str)) > 0) { /* Get number of bytes to read */
esp.m.ipd.read = 1; /* Start reading network data */
esp.m.ipd.tot_len = len; /* Total number of bytes in this received packet */
