lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Using LWIP o the Zynq board to send out data in RAW mode ca


From: Sab VS
Subject: [lwip-users] Using LWIP o the Zynq board to send out data in RAW mode causes problems
Date: Fri, 30 Mar 2018 15:00:29 -0400

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]