Kbase P60714: Socket is not reading all the data sent
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
FACT(s) (Environment):
Progress 9.x
SYMPTOM(s):
Socket is not reading all the data sent
CAUSE:
MEMPTR is not set to 0 causing problems when reading remaining data
FIX:
MEMPTR should be set to 0 after reading and processing the previous data in READ socket procedure, for example:
PROCEDURE readHandler:
DEFINE VARIABLE l AS INTEGER NO-UNDO.
DEFINE VARIABLE str AS CHARACTER NO-UNDO.
DEFINE VARIABLE b AS MEMPTR NO-UNDO.
l = vSocket:GET-BYTES-AVAILABLE().
IF l > 0 THEN DO:
SET-SIZE(b) = l + 1.
vSocket:READ(b, 1, l, 1).
str = GET-STRING(b,1).
PUT STREAM outfile CONTROL str.
SET-SIZE(b) = 0.
wloop = YES.
END.
ELSE DO:
wloop = NO.
OUTPUT STREAM outfile CLOSE.
vSocket:DISCONNECT().
END.
END.