lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] Terminating a blocked lwip_recv


From: Farid Mahini
Subject: RE: [lwip-users] Terminating a blocked lwip_recv
Date: Wed, 7 Jul 2010 08:55:41 -0400

Thank you Kieran.

I had tried a non-blocked lwip_recv call, but it was ignoring the rcv
timeout value and the call was returing immediately. Yesterday, I
implemented a similar method as you had described after finally gotting
the non-blocking method to work; The problem was in the lwip_recvfrom in
the socket.c API. First time lwip_recvfrom is called, it returns after
desired timeout period with TIMEDOUT error flag, but subsequent calls
return immediately. I modified the lwip_recvfrom to clear the conn error
flag at the top every time the method is called. As I recall, this is
how receive works in Unix Sockets. 

1) Is it better to modify the netconn_recv since that is the one which
sets the error flag? I am not familiar with lwIP inner workings. 

2) How can I make the call to lwip_accept a non-blocking one?


Thanx,
-Farid



"Commitment is a journey and not a destination." Author Unknow
 
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Kieran Mansley
Sent: Wednesday, July 07, 2010 7:01 AM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] Terminating a blocked lwip_recv


On 6 Jul 2010, at 17:46, Farid Mahini wrote:

> How can I terminate a blocking socket (lwip_rec and also lwip_accept)
? I am running within FreeRTOS on AVR32.

There is no safe way to do this on lwIP.  It would involve using the
socket from two different threads and that is not supported.  The best
approach is to set a flag when you want the thread to stop reading, and
a timeout on your lwip_recv() operation.  When lwip_recv() times out
check the flag to see if you should continue blocking, if so call
lwip_recv() again, if not close the connection.

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

***Teletronics Technology Corporation***
This e-mail is confidential and may also be privileged.  If you are not the 
addressee or authorized by the addressee to receive this e-mail, you may not 
disclose, copy, distribute, or use this e-mail. If you have received this 
e-mail in error, please notify the sender immediately by reply e-mail or by 
telephone at 267-352-2020 and destroy this message and any copies.  

Thank you.

*******************************************************************



reply via email to

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