David Hammerton wrote:
closing a socket, whilest thread 1 is still using it for send/recv, which causes a problem - as yes, that would be a problem in any socket environment.
I think some socket environments support this. The result would be that the send/recv call returns with an error message "socket closed".
So the send there would be happening on the TCP thread (as a result of the message), is that safe to happen while you are reading on your read/write thread anyway? It must be, as if your read/write thread does a send() followed immedietly by a recv(), it's going to be the same thing.
No, the send() finishes (data copied into tcp_raw buffers) before it returns. The means the netconn's state reaches idle (or 'none' in the code) so it's free to acept a recv().
Ok. A little while ago I had an lwIP app that was written using the BSD socket layer, and this is exactly what I did. I had to modify the select() call to be able to pass in another object (representing a semaphore, really) that could be used to interrupt the select() call. I couldn't see any way of creating a socketpair() like object to interrupt the select() call. There is no built in way to do this with the BSD socket layer in lwIP, correct?
Yeah, that's a point currently missing with the basic select() implementation we have. Usually, you would just create a loopback socket and trigger it, although that's rather unperformant, too.
But for the netconn layer, I guess I can do my own thing. Is this (below)the correct way to do it?
Seems so, yes. Although there may be more arguments to your netconn_calback() than RECV_PLUS.

Simon

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

Reply via email to