Hi,

I am currently trying to use LWIP by calling tcp_write() and tcp_output()
once a connection has been established and an incoming request is
generated. I set a variable when an incoming reuest is generate and use a
global tcp_pcb structure to know which connection to send data on

nt send_data()
{
    struct tcp_pcb *pcb;
    err_t err;
    unsigned port = 8;

    /* create new TCP PCB structure */
    pcb = tcp_new();
    gl_pcb=pcb;
    if (!pcb) {
        xil_printf("Error creating PCB. Out of Memory\n\r");
        return -1;
    }

    /* bind to specified @port */
    err = tcp_bind(pcb, IP_ADDR_ANY, port);
    if (err != ERR_OK) {
        xil_printf("Unable to bind to port %d: err = %d\n\r", port, err);
        return -2;
    }

    /* we do not need any arguments to callback functions */
    tcp_arg(pcb, NULL);

    /* listen for connections */
    pcb = tcp_listen(pcb);
    if (!pcb) {
        xil_printf("Out of memory while tcp_listen\n\r");
        return -3;
    }

    /* specify callback to use for incoming connections */
    tcp_accept(pcb, send_accept);
    tcp_sent(pcb,send_over);
    //err = tcp_write(pcb, dat, dat_len, 1);
    //tcp_output(pcb);

    xil_printf("TCP echo server started @ port %d\n\r", port);

    return 0;
}


However, I observe sometimes that LWIP appears to hang when it is trying to
send data back. A call to tcp_sndbuf() shows that the buffer length is not
going back to its original length. It is not currently happening so I dont
know if the problem is fixed , but I wanted to check if there is something
wrong with my setup.

Is there any example on how to send data using LWIP RAW?

Right now I call tcp_write() and tcp_output() in a loop. Is there any other
function that I should be calling?
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to