lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] prioritizing of active connections


From: Noam Weissman
Subject: Re: [lwip-users] prioritizing of active connections
Date: Sat, 24 Sep 2016 12:58:10 +0000

Hi,


Doing some "dirty" trick will not help but cause other problems. IwIP can back-fire and

you will get unpredictable results. Problems that can be difficult to find.


sys_timeout is an LwIP function that runs inside the context of LwIP. Time interval is in milliseconds.


That means that if you set it to 100ms it will call your function (only once) when time elapses.


So instead of using the poll call back that is triggered at best every 0.5 seconds ... you can set your

own timeout function that will handle some house keeping at a faster rate. Do remember that if you

need it to periodically do something you need to set it again and again... until you finish the process.


BR,

Noam.




From: lwip-users <lwip-users-bounces+address@hidden> on behalf of Norbert Kleber <address@hidden>
Sent: Saturday, September 24, 2016 11:20 AM
To: address@hidden
Subject: Re: [lwip-users] prioritizing of active connections
 

Hi Noam,


thank you for your suggestion. I guess I will start with an OS for the next project. For this one it's allready to late I am afraid (thesis due date next month). I didn't fully understand the explanation in the wiki regarding the sys_timeout(TMR_INTERVAL, function , NULL); function. Which timer triggers this function and how can i calculate the exact timing of the sys_timeout?

For now i found an quick and dirty approach which i can't recommand to anyone. I just call 2x tcp_tmr() directly after my computing work is done. This improves my performance. Where i needed 36 seconds for one run I now only need 16 seconds.


sincerly,

Norbert


Am 23.09.2016 um 18:30 schrieb Noam Weissman:

Hi Norbert,


First of all I would suggest changing your design and use an OS. I am running FreeRTOS

on STM micro's for 6 years now and I do not see myself doing it any other way.


The STM32F4 is a strong micro with sufficient power to do much more then you do now.


If you run an OS there will be a small overhead but your system design will be much simpler

to menage.


If you use Socket API you can send data outside of the LwIP context. If you use RAW API

you cannot send data from outside of the LwIP context and must take that into consideration:


First option protect the code that is called from outside of the LwIP context. Either by using a

critical section (OS).... or using the poll call back.... or triggering LwIP own system_timer call-back:


    sys_timeout(TMR_INTERVAL, function , NULL);


The above is an LwIP internal timer handling. You pass the function you want (see prototype)

with or without parameters and it will be triggered when time expires.



BR,

Noam.



From: lwip-users <lwip-users-bounces+address@hidden> on behalf of Norbert Kleber <address@hidden>
Sent: Friday, September 23, 2016 6:58 PM
To: address@hidden
Subject: [lwip-users] prioritizing of active connections
 
Hi evereyone,

I got some questions again.

I am using the lwIP on a STM32F4 mikrocontroller without OS. A client
will connect to the stack at two ports for transmission. First port will
be used for controlsignals and second for datatransmission. The whole
System works sequentially.

Firstly 1 package will be received on the ctrl connection afterwards we
receive many packages on the dataconnection. Now I was wondering that
the stack acknowlegded all data packages before he acknowledges the ctrl
package. Due to the operation of the µC I can tell that he received the
package right away and ofcause i use the acknowledgement function in the
receive function.  But somehow it is severly delayed approx. 200ms but
the later received data packages all get acknowledged right away.

Does the stack some prioritizing between open connections? Or is it due
to the Ctrl Package being quite short?

Also I am doing some computational work outside of the callback
functions and want to transmit some of the results asap over the ctrl
connection. Is there a way to do that without waiting for the polling
function? Or is there a way to trigger the polling function somehow for
a instant call? Also it seemed like i can't use tcp_write if i am
outside of a callback function (i was storing the pointer to the pcb in
a global variable).

sincerly,

Norbert


_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users
lists.nongnu.org
Welcome to the lwip-users mailing list. Use it to ask questions, share your experience and discuss new ideas. To see the collection of prior postings to the list ...



_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

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