|
From: | address@hidden |
Subject: | Re: [lwip-devel] Feature request: make socket errors public on a per socket basis |
Date: | Mon, 21 Jan 2013 20:55:52 +0100 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
RAc wrote:
the err member variable stored in struct lwip_sock should be accessible for evaluation by applications.
It is: call getsockopt(s, SOL_SOCKET, SO_ERROR, ...) to get and clear it at the same time.
The errno mechanism is useless because the error code is not accessible on a per socket basis.
That doesn't make it useless. You can even override set_errno() to get a thread-specific errno.
I suggest adding the following to sockets.c: int lwip_getsockerr(int socket) { // add some sanity checks here return (get_socket(socket)->err); }
Our socket API is meant to be an implementation of the standards. Being like that, you should use the method described above.
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |