lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] tcp connection issue


From: Papp Szilveszter
Subject: [lwip-users] tcp connection issue
Date: Sat, 26 Feb 2011 15:53:04 +0100

Hello Dear Mail-List Members!

I'm going to add a debug functionality to my project using lwip. I'm
planning to do this with a telnet connection. The idea was, a client
connect to server port, which listening for incoming tcp connection,
then after a successful connection it work as an alternative for
"printf" usually used in serial port debug messages. The software
sends messages through a message queue, and the telnet connection task
sends it with netconn_write() toward to client. Source code below.
The problem is, when a cliennt connected it can receive messages, but
when the client sends some data (or just a char) the lwip stack
crashes completly, even the http server listening on different port.
The result is "The connection with the server was reset ".

Thank You in advance!

Cheers,
Szilveszter Papp

__CODE___

static void prvTelnetTask( void *pvParameters )
{
        struct netconn *pxTelnetListen, *pxTelnetConn;
        char *Msg;
        err_t err;

        pxTelnetListen = netconn_new( NETCONN_TCP );
        netconn_bind(pxTelnetListen, NULL, telnetPORT);
        netconn_listen(pxTelnetListen);

        while(1) {
                pxTelnetConn = netconn_accept(pxTelnetListen);
                if (pxTelnetConn != NULL) {
                        do {
                                xQueueReceive(xTelnetQueue, &Msg, 
portMAX_DELAY);
                                err = netconn_write(pxTelnetConn, Msg, (u16_t) 
strlen(Msg), NETCONN_NOCOPY);
                                HW_LEDGreenToggle();
                        } while(err == ERR_OK);

                        netconn_close(pxTelnetConn);
                        while (netconn_delete(pxTelnetConn) != ERR_OK) {
                                vTaskDelay(webSHORT_DELAY);
                        }
                }
        }
}



reply via email to

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