lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Timers in LWIP and socket protection


From: Muhamad Ikhwan Ismail
Subject: [lwip-users] Timers in LWIP and socket protection
Date: Mon, 14 Jan 2008 08:18:05 +0000

Hi,

I got some qs on timer functions on lwip, read some thread on it previously but it doesnt really answer my qs.
I ll try to generalize this so that any future user can use this thread for the same problem.
Im using lwip 1.2 porting it on a SMX OS on PowerPC MPC852T. Just wanna make sure I am right before i run some multithreading test.

1. The are 2 timers for the whole stack, which are the arptimer and the tcp timer am I right ?

2. The arptimer is initialized in ethernetif_init  through this piece of code :
sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
which then will be assign a struct timeout to the tcpip thread's timeout (since I call it from the tcpip thread initialization) linked list and will be checked and updated each time I wait on semaphore or fetch a message. Hence I dont have to call the arptimer().
Am I correct so far ?

3. My biggest problem is the tcp_timer. It is called by the tcpip_tcp_timer by tcpip API. But no other function calls the tcpip_tcp_timer
hence I guess I need to call it myself ? If I do have to call it myself, I guess there are 2 ways. One is I call it before I wait for semaphore after tcpip_thread finishes the job
it got with the message it fetched. Or call another thread to call tcpip_tcp_timer which is literally bad cause the stack itself is not multithreading safe, isnt it?
 If  anyone has done something like this and has tips where I can use the timer safely, I'd appreciate any tips.

4.I am writing a telnet server program which have 2 task, both using the same socket for transmit and receive. This is possible if i do a critical section protection each time
the socket does receive or send, preventing simultaneous access on the socket, am I right ?

I am thankful for any answers you could provide me.

Greetings,
Ikhwan





Share life as it happens with the new Windows Live. Start sharing!

reply via email to

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