On Fri, Dec 6, 2019 at 9:46 AM Anurag Biradar <biradar.a@xxxxxxxxxxx> wrote: > > When a stream socket peer has performed an orderly shutdown, > then return value will be 0. > --- > tools/mesh-gatt/gatt.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/mesh-gatt/gatt.c b/tools/mesh-gatt/gatt.c > index bff5947..1bd9868 100644 > --- a/tools/mesh-gatt/gatt.c > +++ b/tools/mesh-gatt/gatt.c > @@ -416,7 +416,7 @@ static bool sock_read(struct io *io, bool prov, void *user_data) > msg.msg_iovlen = 1; > > while ((len = recvmsg(fd, &msg, MSG_DONTWAIT))) { > - if (len <= 0) { > + if (len < 0) { > if (errno == EAGAIN) > break; > return false; > @@ -431,6 +431,11 @@ static bool sock_read(struct io *io, bool prov, void *user_data) > net_data_ready(res, len_sar); > } > } > + > + /* When socket is orderly closed, then recvmsg returns 0 */ > + if (len == 0) > + return false; > + > return true; > } > > -- > 2.7.4 > Gentle Ping. Thanks Anurag