Hello Uwe,
I have the call back for accept set as follows.
In the main application, I call echo_accept.
server_tpcb = tcp_new();
ui32Err = tcp_bind(server_tpcb, (ip_addr_t *)&g_ui32IPAddress, NODE_TCP_SERVER_PORT);
UARTprintf("\n%d",ui32Err);
server_tpcb = tcp_listen(server_tpcb);
tcp_accept(server_tpcb, echo_accept);
which is as follows.
static err_t echo_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
LWIP_UNUSED_ARG(arg);
LWIP_UNUSED_ARG(err);
tcp_setprio(pcb, TCP_PRIO_MIN);
tcp_arg(pcb, NULL);
tcp_recv(pcb, echo_recv);
tcp_err(pcb, echo_err);
tcp_poll(pcb, NULL, 0);
return ERR_OK;
}
Do you mean that instead of using pcb I should have another tcp_pcb e,g, newpcb that is assigned from the pcb in the call back.
struct tcp_pcb *newpcb;
static err_t echo_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
LWIP_UNUSED_ARG(arg);
LWIP_UNUSED_ARG(err);
newpcb = pcb;
tcp_setprio(pcb, TCP_PRIO_MIN);
tcp_arg(pcb, NULL);
tcp_recv(pcb, echo_recv);
tcp_err(pcb, echo_err);
tcp_poll(pcb, NULL, 0);
return ERR_OK;
}
Regards