I have a project which requires high speed (several megabits/s) non-blocking UDP send.
I usually prefer zero copy for data rates like these.
Poking around in the documentation seems to suggest that netconn is good for this.
However, when I create my socket with netconn_new_with_callback, my callback is never called which means I can't reclaim completed buffers.
My net functions are as follows:
Code: Select all
void net_event_cb(struct netconn* nc, enum netconn_evt evt, u16_t len)
{
printf("net_event(%d)\n", evt);
switch (evt)
{
case NETCONN_EVT_SENDPLUS: {
printf("UDP sent %d bytes\n", len);
}
}
}
void net_init(void)
{
netconn_thread_init();
assert((conn = netconn_new_with_callback(NETCONN_UDP, net_event_cb)) != NULL);
netconn_set_nonblocking(conn, 1);
ip_addr_t addr;
addr.type = ESP_IPADDR_TYPE_V4;
addr.u_addr.ip4.addr = IPTUPLE_TO_UINT(IPADDR);
assert(netconn_connect(conn, &addr, PORT) == ERR_OK);
}
Code: Select all
assert(netbuf_ref(netbuf, rx_buffer, length) == ERR_OK);
assert(netconn_send(conn, netbuf) == ERR_OK);
How can I work out what's up with the callback?