Hi,
I am creating a client/server-connection using a socket.
The server just returns what it receives:
filename local socket ':5000' server reconn=0;
data _null_;
infile local recfm=v;
input;
file local;
response=_infile_;
put response;
run;
The first client looks like this:
filename remote socket 'localhost:5000';
data _null_;
infile remote;
request="Request1_from_client";
file remote;
put request;
input;
res=_infile_;
file log;
put res;
request="Request2";
file remote;
put request;
input;
res=_infile_;
file log;
put res;
stop;
run;
From the server the following is received:
Request1_from_client
Request2
The second client uses CALL routines instead of file/infile:
filename remote socket 'localhost:5000';
data _null_;
fid=fopen('remote','W',2048,'V');
request="Request1_from_client";
rc=fput(fid,trim(request));
rc=fwrite(fid);
rc=fread(fid);
length res $2048;
rc=fget(fid,res);
file log;
put res;
request="Request2";
rc=fput(fid,trim(request));
rc=fwrite(fid);
rc=fread(fid);
rc=fget(fid,res);
file log;
put res;
stop;
run;
From the server the following is received:
Request1_from_client
Request1_from_clientRequest2
The problem is, that the File Data Buffer (FDB) isn't cleared, that is the second message is just added to the first message.
The question is how to clear the File Data Buffer (FDB)?
Note: One workaround is to close and reopen the connection but this is a bad solution because of time overhead, a socket-connection should stay open until work is done.
Regards,
Jesper