[Top][All Lists]

[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!

Szilveszter Papp


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

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

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

                        while (netconn_delete(pxTelnetConn) != ERR_OK) {

reply via email to

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