lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Detect RST when using non blocking read.


From: Karlsson, Johnny
Subject: [lwip-users] Detect RST when using non blocking read.
Date: Mon, 7 May 2012 15:33:05 +0200

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:

 

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

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]