tabascoeye / lwip

a fork of the light-weight IP stack
Other
15 stars 6 forks source link

socket API is missing getlasterror() #9

Open tabascoeye opened 10 years ago

tabascoeye commented 10 years ago

The socket API is missing a function to find out the last error that happened to a socket. if you don't have an "errno" mechanism in your system, this might be a good alternative to find out what specific error happened last on a socket.

tabascoeye commented 10 years ago
int lwip_getlasterror(int s)
{
  struct lwip_sock *sock = get_socket(s);
  if(sock){
    return(sock->err);
  } else {
    return(-1);
  }
}