lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Non-blocking socket I/O


From: Piero 74
Subject: Re: [lwip-users] Non-blocking socket I/O
Date: Wed, 27 Feb 2008 09:26:50 +0100

Hi.

i'm starting to use lwip 130rc1 and i have to use socket.
I need to use non-blocking socket.

My idea is to use select() , with 2 socket in listen mode inside and 2 udp socket.

when a new connection is incoming, add it to select.

what do you think about this idea? can you help me to implement it? i have no experience with socket....

Bye,
Piero

2008/2/27, Muhamad Ikhwan Ismail <address@hidden>:

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.

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


reply via email to

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