Hi!

There doesn't seem to be a way to detect that a remote host sends a RST
message when using non blocking read. In lwip_recvfrom when a host does
a regular gracious shutdown this bit of code returns 0:

/* We should really do some error checking here. */
        LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): buf == NULL,
error is \"%s\"!\n",
          s, lwip_strerr(err)));
        sock_set_errno(sock, err_to_errno(err));
        if (err == ERR_CLSD)) {
          return 0;
        } else {
          return -1;

But if a RST is sent then it returns -1, which is the same return code
as no data available. When I changed the code to:

if ((err == ERR_CLSD) ||(err == ERR_RST)) {
 return 0;
 } else {
 return -1;


then I can detect a RST. Is there a problem doing it that way? Or should
a check for RST in another way?

Cheers

/Johnny Karlsson



_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to