[Xitami-Dev] read_TCP returns 0 instead of -1

Rafael Cano Pérez xitami-dev@lists.xitami.org
Fri, 7 Jun 2002 16:40:00 +0200


 Hello Imatix.

 I am using lrwplib.c for a prototype LRWP application,
 wich will be later implementing the LRWP via an
 SMT agent.

 In read_full_TCP() in lrwplib.c, after calling
 read_TCP() reads the return code, and compares
 it to SOCKET_ERROR for errors. This macro
 is defined in sfl.h as -1, but when the socket is
 closed, for example when xitami is closed, read_TCP
 returns 0, making any application based on lrwplib.c
 go into an infinite loop.
 Changing the test against 0
 ...
 if (chunkLen == 0)
  return SOCKET_ERROR;
 ...

 fixes the error.

 A bug in sfl.h, lrwplib.c or read_TCP() ??

 I'm thinking of writing an ISAPI dll that
 accepts LRWP2 connections and acts as the
 LRWP agent in Xitami. Is this already available?
 ( I know there is the other way round, LRWP client
  calling ISAPI.dll ).

 Kind regards.

   Rafael Cano Pérez