|
From: | Muhamad Ikhwan Ismail |
Subject: | RE: [lwip-users] Listen on more then one port with lwIP |
Date: | Fri, 2 Jan 2009 10:06:11 +0000 |
Hi, It seems to me you might have a concurrent access problem on your sys_arch layer since when you had the 2 listener socket in a single task, it worked. Try something like this, -Block both thread -start one of them, and wait till the netconn_accept is done -start the 2nd thread after that If it works then my assumption could be right. The only thing the 2 socket shares in netconn_accept is the mailbox of the tcpip tasks and the same function call on sys_arch layers. If that the case you might wanna do preemption protection to critical codes in the sys_arch layer? > Date: Fri, 2 Jan 2009 10:55:06 +0100 > From: address@hidden > To: address@hidden > Subject: Re: [lwip-users] Listen on more then one port with lwIP > > as you top post I do so to so the source is preserved below. > > lwIP version is 1.3 > Microchip GCC C32 MIPS compiler > FreeRTOS 5.1.0 > > By not working I mean none of the listner threads return after > netconn_accept which they do if I only have one thread. > > I pretty much expected this to be a usage fault and that the way I use > dthe code was invalid. > > Cheers > /Ake > > On Fri, Jan 2, 2009 at 10:31 AM, Muhamad Ikhwan Ismail > <address@hidden> wrote: > > > > Hi, > > > > It would help the developer answer your question, if you explain what do you > > mean by it does not work > > e.g. where it blocks, you are getting no data or something like that. You > > should also search the mailing list > > for previous posts, someone might have asked the same q. > > > > You might want to info them also of your port and version. > > > > Greetings > > Ikhwan > > > > > >> Date: Thu, 1 Jan 2009 23:00:54 +0100 > >> From: address@hidden > >> To: address@hidden > >> Subject: [lwip-users] Listen on more then one port with lwIP > >> > >> 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 > >> address@hidden > >> http://lists.nongnu.org/mailman/listinfo/lwip-users > > > > ________________________________ > > It's the same Hotmail(R). If by "same" you mean up to 70% faster. Get your > > account now. > > _______________________________________________ > > lwip-users mailing list > > address@hidden > > http://lists.nongnu.org/mailman/listinfo/lwip-users > > > > > > -- > --- > Ake Hedman > D of Scandinavia, http://www.dofscandinavia.com > > > _______________________________________________ > lwip-users mailing list > address@hidden > http://lists.nongnu.org/mailman/listinfo/lwip-users Send e-mail anywhere. No map, no compass. Get your HotmailĀ® account now. |
[Prev in Thread] | Current Thread | [Next in Thread] |