|
|
The following example describes the steps to create a call socket, send and
receive data over a connection, and then close the socket using IPCINT on a
local node. This sample session assumes a remote node is also using IPCINT.
The remote node running IPCINT sends the local node a message as described in
step 7.
The steps below follow the SVC requestor processing example in
Figure 1-10 "SVC Requestor Processing
Example" in Chapter 1 "NetIPC Fundamentals" The
remote node should follow the steps in the SVC server processing example in
Figure 1-11 "SVC Server Processing Example"
in Chapter 3 "NetIPC Intrinsics"
User input is bold in the examples provided. For information about NetIPC
intrinsic parameters refer to the intrinsic descriptions in
Chapter 3 "NetIPC Intrinsics" Intrinsic parameter
names that differ from the names used as prompts in IPCINT are included in
parentheses in the discussion of the examples.
Step 1
Run the IPCINT program from the MPE XL prompt. A log of the session will be
written to a file named IPCLOG.
(1) :RUN IPCINT.NET.SYS
(C) COPYRIGHT Hewlett-Packard Company 1989
>>>> IPC Interpreter B020000 FRI, SEP 15, 1989, 9:59 AM
>
To exit IPCINT at any time enter EX at the IPCINT prompt (>).
Step 2
Enter the IPCINT abbreviation for the desired intrinsic (See
Table A-1 "NetIPC Intrinsics IPCINT
Abbreviations"). In this example, CR for IPCCREATE is
entered.
You are prompted for all required input parameters. You must enter 2
for X.25 direct access at the Protocol prompt. In this example, enter
N (no) at the Catch All socket prompt (opt
code 144, bit 2). Enter the network name configured for your network at the
Network name (opt code 140) prompt.
After entering all required parameters, the intrinsic is executed. The call
socket descriptor (calldesc) is returned in the pseudovariable
"C".The output parameters are interpreted and displayed. In this example, a
call socket has been created.
(2) CR
Protocol: 2
Catch All socket (Y/N)? N
Network name (8 chars): X25net
-----> Executing : IPCCREATE
CALL = 12
Step 3
Execute the IPCDEST intrinsic by entering DEST at the prompt.
You are prompted for the remote Node name (location)
where the destination socket will be created. In this example, RAINBOW
is used. If you leave the node name prompt blank, you will be prompted for the
remote X.25 address expressed in hexadecimal.
Enter a protocol relative address (protoaddr) in the decimal
range 30767 to 32767 for the remote address. In this example, 31000 is
used. The IPCDEST intrinsic is executed and a destination descriptor
(destdesc) will be returned in pseudovariable "D".
(3) DEST
Node name (50 chars): RAINBOW
Protocol relative address (16 bit integer): 31000
-----> Executing : IPCDEST
DEST = - 1
Step 4
In order to execute this step, the remote node server program or IPCINT
must have already executed an IPCCREATE followed by an IPCRECVCN. The remote
waits for the local to send the connection request. NetIPC provides a timeout
so the IPCRECVCN will not wait indefinitely.
Execute IPCCONNECT by entering CN at the prompt. You are
prompted for the call socket descriptor. To use the default, press
[RETURN] which is the value returned in pseudovariable "C" by the
previous call to IPCCREATE.
You are prompted for the destination socket descriptor. To use the default,
press [RETURN] which is the value returned in pseudovariable "D" by
the previous call to IPCDEST.
You are prompted for access to the call user data (CUD) field
(opt 144, protocol flags, bit 17). In this example, Y
(yes) is entered. Selecting "yes" allows you to enter up to 128 bytes of user
data at the Call User Data (128 chars) prompt (opt
code 2).
Next, you are prompted for a facility set name (opt code 142).
To use the default configured for you network, press [RETURN]. At the
Special Facility Field (opt code 145) prompt, enter
up to 109 characters representing additional features to be added to the
facility set. Press [RETURN] for no additions to the facility field.
The IPCCONNECT intrinsic is executed and a virtual socket descriptor
is returned.
In the example, the statement, "No address in CUD" refers to the fact
that you requested full access to the CUD.
(4) N
Source socket desc (32 bit integer/C/D/V): [RETURN]
Destination desc (32 bit integer /C/D/V): [RETURN]
No address in CUD (Y/N)? Y
Call User Data (128 chars):hFCAA0001
Facility name (8 chars): [RETURN]
Special Facility Field (109 chars):[RETURN]
-----> Executing : IPCCONNECT
VC = 7
No address in CUD
Step 5
Execute IPCRECV by entering R at the prompt to receive the
response to the previous connection request.
The default value for the VC socket descriptor is the value returned in the
last IPCCONNECT (or in the case of an incoming call, by
IPCRECVCN). This value is the default for any subsequent
IPCSEND or IPCRECV calls.
To use default values, press [RETURN]. Buffer length
(dlen) defaults to 4096 bytes. Preview data and
Destroy data (flags 30 and 29) default to no
(N). Data offset (opt code 8) is defaulted
to none.
(5) R
Connect socket desc (32 bit integer /C/D/V): [RETURN]
Buffer length (bytes): [RETURN]
Preview data (Y/N)? [RETURN]
Destroy data (Y/N)? [RETURN]
Data offset (bytes): [RETURN]
-----> Executing : IPCRECV
MAX_LEN = 4096
RECV_LEN = 0
BUFFER = ''
Note that there is no data returned in "Buffer" because the function of
this call to IPCRECV is to accept the connection request from the remote
node.
Step 6
Execute a call to IPCSEND by entering S at the prompt.
Enter a value for the buffer length. IPCINT will send a string of characters
equal to the number of bytes specified. If you enter 0 for buffer length, you
will be prompted to enter the contents of the data you are sending. You can
specify up to 80 characters of data. At the Buffer prompt enter the
data to send. In this example, 'Hello from local' is entered.
Pressing [RETURN] at the VC socket desc prompt which default
to the VC socket descriptor returned by the previous call to
IPCCONNECT (in this example). To use default values, press
[RETURN]. Q bit set and D bit set (opt code
144, bit 19 and bit 18) are defaulted to no (N). Data offset
(opt code 8) defaults to none.
(6) S
Buffer length (bytes): 0
Buffer: 'Hello from local'
Connect socket desc (32 bit integer /C/D/V): [RETURN]
Q bit set (Y/N): [RETURN]
D bit set (Y/N)? [RETURN]
Data offset (bytes): [RETURN]
-----> Executing : IPCSEND
In order for the remote node to receive the sent data, an IPCRECV must be
executed from the remote node with IPCINT (or a server program).
Step 7
Before executing step 7, the remote must execute IPCSEND data to the local
node (see step 6, IPCSEND).
Execute IPCRECV to receive data by entering R at the prompt.
Step 7 assumes a remote node using IPCINT has sent you a message.
Press [RETURN] to use the default VC socket descriptor
(vcdesc). To use default values, press [RETURN].
Buffer length defaults to 4096 bytes. Preview data and
Destroy data (flags 30 and 29) default to no (N). Data offset
(opt code 8) is defaulted to none.
Values returned by IPCRECV include data sent from the remote
displayed at the prompt: Buffer = (data), length of the received data
(dlen), and the buffer length input displayed as MAX_LEN
(dlen, from input).
(7) R
Connect socket desc (32 bit integer /C/D/V: [RETURN]
Buffer length (bytes): [RETURN]
Preview data (Y/N)? [RETURN]
Destroy data (Y/N)? [RETURN]
Data offset (bytes): [RETURN]
-----> Executing : IPCRECV
MAX_LEN = 4096
RECV_LEN = 17
BUFFER = 'Hello from remote'
Step 8
Execute IPCSHUTDOWN to shutdown the socket by entering SHUT
at the prompt.
At the descriptor prompt, enter a descriptor (C, D or V) in order to indicate
which socket needs to be shutdown. In this example, the VC socket descriptor,
V is entered.
You are prompted for a reason code (opt code 143). In this
example, 100 is entered which will cause a clear packet to be sent.
The clear packet will contain a cause code zero (0), and diagnostic code 100.
(IPCCONTROL is used to access cause and diagnostic codes.)
(8) SHUT
Descriptor (32 bit integer /C/D/V): V
Reason code (16 bit integer): 100
Call User Data (128 chars) :
-----> Executing : IPCSHUTDOWN
Step 9
Exit from the IPCINT program by entering EX at the prompt.
(9) EX
|