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

Table Of Contents
Chapter 4 141
NetIPC Examples
Example 2
procedure ipcerrmsg; intrinsic;
procedure ipcget; intrinsic;
procedure ipcgive; intrinsic;
procedure ipcrecv; intrinsic;
procedure ipcrecvcn; intrinsic;
procedure ipcsend; intrinsic;
procedure ipcshutdown; intrinsic;
begin
$if 'native_mode'$
writeln
('example program vector1 to show vectored data operation in Native Mode');
$else$
writeln
('example program vector1 to show vectored data operation in Compatibility
Mode'
);
$endif$
{ specify the address of the local socket }
adrs[0] := SOCK_ADDR div 256; { first 8 bits of 32000 }
adrs[1] := SOCK_ADDR mod 256; { last 8 bits of 32000 }
{ initialize opt array for one entry }
initopt ( opt, 1, result16 );
if result16 <> 0 then
writeln ('initopt failed');
{ add the option for specification of the socket's address }
addopt ( opt, 0, 128, 2, adrs, result16 );
if result16 <> 0 then
writeln ('addopt failed');
{ Create the local socket by using the special option 128 which allows }
{ specification of the socket's address using the opt array. }
ipccreate ( 3, 4, , opt, sd_local, result );
if result <> 0 then
writeln ('ipccreate of local socket failed ', result );
{ Local side receives the connection }
ipcrecvcn ( sd_local, cd_local, , , result );
if result <> 0 then
writeln ('ipcrecvcn failed');
{ set up vectors, ready for sending and receiving data }
$if 'native_mode'$
vd.d_desc_dataptr1 := globalanyptr ( addr ( messag1 ) );
vd.d_desc_dataptr2 := globalanyptr ( addr ( messag2 ) );
$else$
vd.d_desc_dst1 := 0; { this is ignored }
vd.d_desc_dataptr1 := baddress ( messag1 );
vd.d_desc_dst2 := 0; { this is ignored }
vd.d_desc_dataptr2 := baddress ( messag2 );
$endif$