NetIPC 3000/XL Programmer's Reference Manual (5958-8600)

Table Of Contents
Chapter 4 169
NetIPC Examples
Example 4
optlen := 50;
addopt(opt, 1, 145, optlen, sf,result16);
if result16 <> 0 then
writeln('addopt IPCRECV sf failed ', result16:1);
writeln;
writeln('##### IPCRECV ');
ipcrecv ( cd_remote, , , ,opt, result );
if result <> 0 then
writeln ('ipcrecv to complete connection failed ',result);
(* check receive CUD *)
optlen := CUD_MAX;
readopt(opt, 0, optioncode, optlen,cud,result16);
if result16 <> 0 then
writeln('CUD readopt failed ', result16:1);
if optlen <> CUD_MAX then
writeln('CUD length error : (length = ',optlen:1, ' )');
i := 1;
while i <= optlen do
begin
if cud[i] <> (CUD_MAX - i) then
writeln('CUD error : #',i:1,' ',cud[i]);
i := i + 1;
end;
(* check special facility *)
optlen := 50;readopt(opt, 1, optioncode, optlen,sf,result16);
if result16 <> 0 then
writeln('SF readopt failed ',result16:1);
writeln
('facilities received in call accepted packet (length = ',optlen:1,')');
for i := 1 to optlen do
write(sf[i]:1,' ');
writeln;
(****************************** IPCSEND (2000 bytes) *****************)
for i := 1 to 2000 do
msg[i] := i mod 100;
writeln;
writeln('##### IPCSEND (2000 bytes data)');
ipcsend ( cd_remote, msg, 2000, , , result );
if result <> 0 then writeln('send 2000 bytes data failed ',result:1);
(****************************** IPCRECV ******************************)
dlen := 12;
writeln;
writeln('##### IPCRECV last message');
ipcrecv( cd_remote, data, dlen,,, result);
if result <> 0 then
writeln('ipcrecv failed ',result);
(* check the correct data was received *)