Hi everyone,
First of all, please forgive my English writing, I will try to do my best.
Well, I am currently trying to make Progress & Java talk together through a socket.
I have a Java socket server listening on a port, upon which a Progress client gets a connection, succesfully.
But then I try to write a string (zipped through the zlib library) on a memptr and then send this memptr on the socket.
But the Java server seems to hang on the socket.readLine() instruction (it does not seem to guess the client finished to write on the socket). So I added the '~n' character to the zipped string, but then the unzipping (on the Java side) bugs ("invalid distance code" exception)...
Here is the Progress code :
Is there any better way to tell Java that the writing is done ?
I'm sure this message is far from being clear, so do not hesitate to send me Private Messages for further explanations.
Thanks in advance for your help...
Julien
PS : the Progress zipping / Java unzipping works well when I make this through files instead of memptrs...
First of all, please forgive my English writing, I will try to do my best.
Well, I am currently trying to make Progress & Java talk together through a socket.
I have a Java socket server listening on a port, upon which a Progress client gets a connection, succesfully.
But then I try to write a string (zipped through the zlib library) on a memptr and then send this memptr on the socket.
But the Java server seems to hang on the socket.readLine() instruction (it does not seem to guess the client finished to write on the socket). So I added the '~n' character to the zipped string, but then the unzipping (on the Java side) bugs ("invalid distance code" exception)...
Here is the Progress code :
Code:
DEFINE VARIABLE hndl AS HANDLE.
DEFINE VARIABLE bufSource AS MEMPTR.
DEFINE VARIABLE bufCible AS MEMPTR.
DEFINE VARIABLE bufCible2 AS MEMPTR.
DEFINE VARIABLE monIP AS CHARACTER INIT "" NO-UNDO.
DEFINE VARIABLE monPort AS CHARACTER INIT "" NO-UNDO.
DEFINE VARIABLE msocket AS HANDLE NO-UNDO.
DEFINE VARIABLE connex AS CHARACTER NO-UNDO.
DEFINE VARIABLE varStr AS CHARACTER NO-UNDO.
CREATE SOCKET msocket.
msocket:CONNECT("-H" monIP "-S" monPort.).
IF msocket:CONNECTED()
THEN DO :
RUN zlib.p PERSISTENT SET hndl.
END.
ELSE DO :
MESSAGE "Impossible de se connecter à l'hote".
RETURN.
END.
SET-SIZE(bufSource) = 0.
SET-SIZE(bufCible) = 64.
SET-SIZE(bufCible2) = 64.
varStr = "aaaaaabbbbbbcccccccdddddddeeeeeeefffffff".
SET-SIZE(bufSource) = LENGTH(varStr) + 1.
PUT-STRING(bufSource,1) = varStr.
PUT-STRING(bufCible2,1) = "~n".
RUN zlib_compressBuffer IN hndl (INPUT bufSource, OUTPUT bufCible).
mSocket:WRITE(bufCible,1,GET-SIZE(bufCible)).
mSocket:WRITE(bufCible2,1,GET-SIZE(bufCible2)).
MESSAGE "Compression envoyée".
WAIT-FOR READ-RESPONSE OF mSocket.
I'm sure this message is far from being clear, so do not hesitate to send me Private Messages for further explanations.
Thanks in advance for your help...
Julien
PS : the Progress zipping / Java unzipping works well when I make this through files instead of memptrs...