Shaun Crampton wrote: > I'm looking at lwIP for a new project and I'm trying to understand the > threading model for the socket-alike API. Assuming I'm on a preemptive OS > (Linux), is it safe to > > * concurrently create multiple sockets in different threads
Yes. > * for one single socket, call send in one thread and recv in another > thread (to enable duplex communication). No. > If it's not possible to do duplex communication in that way, is there a > way to do it? > > If I've read the docs correctly, then I think it's up to my application to > stop all threads using the socket before closing it, which is fair enough. That way it would work, but it's not real full duplex then. It's quite hard to make a thread return from recv() once it's blocked there waiting for new data... You can always use select(), but there's no easy way (other than a loopback socket) to make select() return by application software if you're not using a timeout... Simon _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
