Socket Connections - unreliability

Hi all,

We are using a socket (Progress 91C on UNIX) to connect to a 3rd party server on a WIN2000 machine. Works fine most of the time, but occasionally the connection fails causing the progress code to "lock up".

Our code is fairly straight forward (from the Progress documentation) using a read handler, a socket write and a wait-for.

I have put in status lines to try to find out where it gets stuck, and it appears to be after the response is received, the read handler has completed.

It appears that the socket closes, but the program stops running on the "delete object" statement. (relevant code below).

Does anyone have any idea why this might get stuck, and how to overcome the problem?

Thanks in advance,

David

/*------------------------------------------------------------------------------
Purpose:
Parameters: <none>
Notes:
------------------------------------------------------------------------------*/
DEFINE INPUT PARAMETER phost AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pport AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER ppath AS CHARACTER NO-UNDO.

def var vBuffer as memptr no-undo.
def var vStr as char no-undo.

CREATE SOCKET vSocket.
vSocket:SET-READ-RESPONSE-PROCEDURE ("readHandler",THIS-PROCEDURE).
wstatus = vSocket:CONNECT("-H " + phost + " -S " + pport) NO-ERROR.

IF wstatus = NO THEN DO:
DELETE OBJECT vSocket.
serverUnavailable = yes.
return error "Connection to server: " + phost + ", port: " + pport
+ " is unavailable".
END.
else serverUnavailable = no.
vStr = ppath.
SET-SIZE(vBuffer) = LENGTH(vStr) + 1.
PUT-STRING(vBuffer,1) = vStr.
vSocket:WRITE(vBuffer, 1, LENGTH(vStr)).
SET-SIZE(vBuffer) = 0.
assign socketOk = yes
timeOut = yes.
WAIT-FOR READ-RESPONSE OF vSocket pause 46.
vSocket:DISCONNECT().
DELETE OBJECT vSocket. /******* GETS STUCK HERE *******/
if not socketOk then do:
return error "Socket closed unexpectedly".
END.
if timeOut = yes then do:
return error "Connection timed out".
END.
END PROCEDURE.
 
Top