I am new to lwIP and use it with FreeRTOS on a PIC32 so be patient
with  me if this is just a  silly question.

I want to have a web server plus a custom interface on the firmware I
work on at the moment. So I try to solve this starting a new thread
where I initialised lwip and then start two listner threads for the
two ports.

This does not work however even if they each work perfect on there own.

How should this be coded correctly?  Any hints appreciated.

My listner thread look like this

///////////////////////////////////////////////////////////////////////////////
// taskVSCPListner
//

void taskVSCPListner( void *pvParameters )
{
    struct netconn *pxVSCPListener;     // Listens for VSCP connections
    struct netconn *pxNewConnection;

    // Create a new tcp connection handle for VSCP
        pxVSCPListener = netconn_new( NETCONN_TCP );
        netconn_bind( pxVSCPListener, NULL, VSCP_LEVEL2_TCP_PORT );
        netconn_listen( pxVSCPListener );

        // Loop forever
        for( ;; ) {
        
                // Wait for connection.
                pxNewConnection = netconn_accept( pxVSCPListener );

                if ( pxNewConnection != NULL ) {
                
                        // Service connection.
                        vProcessVSCPConnection( pxNewConnection );
                
                while( netconn_delete( pxNewConnection ) != ERR_OK ) {
                                vTaskDelay( webSHORT_DELAY );
                        }
                
                }
                
        }
}


///////////////////////////////////////////////////////////////////////////////
// taskHTTPListner
//

void taskHTTPListner( void *pvParameters )
{
    struct netconn *pxHTTPListener;     // Listens for HTTP connections
    struct netconn *pxNewConnection;

    // Create a new tcp connection handle for HTTP
        pxHTTPListener = netconn_new( NETCONN_TCP );
        netconn_bind( pxHTTPListener, NULL, webHTTP_PORT );
        netconn_listen( pxHTTPListener );
        
        // Create a new tcp connection handle for VSCP
        //pxVSCPListener = netconn_new( NETCONN_TCP );
        //netconn_bind( pxHTTPListener, NULL, VSCP_LEVEL2_TCP_PORT );
        //netconn_listen( pxVSCPListener );

        // Loop forever
        for( ;; ) {
        
                // Wait for connection.
                pxNewConnection = netconn_accept( pxHTTPListener );

                if ( pxNewConnection != NULL ) {
                
                        // Service connection.
                        vProcessConnection( pxNewConnection );
                
                while( netconn_delete( pxNewConnection ) != ERR_OK ) {
                                vTaskDelay( webSHORT_DELAY );
                        }
                
                }
                
        }
}

Cheers
/Ake


-- 
 ---
Ake Hedman
D of Scandinavia, http://www.dofscandinavia.com


_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to