/* Open a TCP socket from the lwip thread.  */
static void tcp_open_cb(void *ctx_p)
/* Open a TCP socket from the lwip thread.  */
static void tcp_open_cb(void *ctx_p)
{
    struct socket_t *socket_p = ctx_p;
    void *pcb_p;
    pcb_p = tcp_new();
    tcp_arg(pcb_p, socket_p);
    tcp_recv(pcb_p, on_tcp_recv);
    tcp_sent(pcb_p, on_tcp_sent);
    tcp_err(pcb_p, on_tcp_err);
    init(socket_p, SOCKET_TYPE_STREAM, pcb_p);
    resume_thrd(socket_p->input.cb.thrd_p, 0);
}