|
From: | Muhamad Ikhwan Ismail |
Subject: | [lwip-users] Non-blocking socket I/O |
Date: | Wed, 27 Feb 2008 08:01:34 +0000 |
Hi, I have successfully integrated lwIP version 1.2.0 in a PowerPC microcontroller running SMX RTOS thanks to the support I have gotten from lwIP community. I am now trying to implement non-blocking socket operation for connect() and write(). For accept() and read() the socket is now non-blocking since I use select(). I am aware that there is such a thread previously, however it ends with no clear result. I am wondering why do we have to block write() from the first place? And as for connect(), I am planing to implement the following changes: 1. in netconn_connect(), if the O_NONBLOCK flag is set, then use sys_arch_mbox_try_fetch() and return EINPROGRESS. Then set the netconn state to NETCONN_CONNECT. Any subsequent connect checks the NETCONN_CONNECT state and returns EALREADY 2. Use the callback function to set the sendevent to plus in the do_connected(). 3. Select() after connection is established will then return a non-zero nready for the writeset. The application then call sys_arch_mbox_tryfetch, free the message, reset the send event to zero and can now begin writing/reading to the socket. Is there any changes or conflicts I should be aware of if i do implement these changes ? I am thankful for any advices you guys could offer, Need to know the score, the latest news, or you need your HotmailĀ®-get your "fix". Check it out. |
[Prev in Thread] | Current Thread | [Next in Thread] |