แก้ไข

แชร์ผ่าน


Changing Conversation States

A change in the conversation state can result from:

  • A verb issued by the local TP.

  • A verb issued by the partner TP.

  • An error condition.

    The following example shows how APPC verbs can change the state of the conversation from SEND to RECEIVE and from RECEIVE to SEND.

Note

Any TP can send or receive data, regardless of whether it is the invoking TP (the TP that started the conversation) or the invokable TP (the TP that responded to a request to start a conversation).

This example shows how APPC verbs can change the conversation state. In this table, each conversation state appears in bold and precedes the APPC verbs that are used while in that state.

Issued by the invoking TP Issued by the invokable TP
TP_STARTED
Conversation state: RESET
MC_ALLOCATE
(synclevel=AP_CONFIRM_SYNC_LEVL)
Conversation state: SEND
MC_SEND_DATA
MC_PREPARE_TO_RECEIVE
(ptr_type=AP_SYNC_LEVEL)
Conversation state: RESET
RECEIVE_ALLOCATE
Conversation state: RECEIVE
MC_RECEIVE_AND_WAIT
(primary_rc=AP_OK)
(what_rcvd=AP_DATA_COMPLETE)
MC_RECEIVE_AND_WAIT
(primary_rc=AP_OK)
(what_rcvd=AP_CONFIRM_SEND)
Conversation state: CONFIRM_SEND
MC_CONFIRMED
Conversation state: SEND
MC_SEND_DATA
MC_CONFIRM
Conversation state: RECEIVE
MC_RECEIVE_AND_WAIT
(primary_rc=AP_OK)
(what_rcvd=AP_DATA_COMPLETE)
MC_RECEIVE_AND_WAIT
(primary_rc=AP_OK)
(what_rcvd=AP_CONFIRM_WHAT_RECEIVED)
Conversation state: CONFIRM
MC_REQUEST_TO_SEND
MC_CONFIRMED
(rts_rcvd=AP_YES)
MC_PREPARE_TO_RECEIVE
(ptr_type=AP_SYNC_LEVEL)
Conversation state: RECEIVE
MC_RECEIVE_AND_WAIT
(primary_rc=AP_OK)
(what_rcvd=AP_CONFIRM_SEND)
Conversation state: CONFIRM_SEND
MC_CONFIRMED
Conversation state: SEND
MC_SEND_DATA
MC_DEALLOCATE
(dealloc_type=AP_SYNC_LEVEL)
Conversation state: RECEIVE
MC_RECEIVE_AND_WAIT
(primary_rc=AP_OK)
(what_rcvd=AP_DATA_COMPLETE)
MC_RECEIVE_AND_WAIT
(primary_rc=AP_OK)
(what_rcvd=AP_CONFIRM_DEALLOCATE)
Conversation state: CONFIRM_DEALLOCATE
MC_CONFIRMED
Conversation state: RESET Conversation state: RESET
TP_ENDED TP_ENDED

Initial States

Before the conversation is allocated, the state is RESET for both TPs.

In the example, after the conversation is allocated, the initial state is SEND for the invoking TP and RECEIVE for the invokable TP.

Changing to RECEIVE State

MC_PREPARE_TO_RECEIVE allows a TP to change the conversation from SEND to RECEIVE state. This verb:

  • Flushes the local LU's send buffer.

  • Sends the AP_CONFIRM_SEND indicator to the partner TP through the what_rcvd parameter of a receive verb. This indicator tells the partner TP that an MC_CONFIRMED response is expected before the partner TP can begin to send data.

    Confirmation processing is performed when the following conditions are true:

  • The ptr_type parameter is set to AP_SYNC_LEVEL.

  • The synchronization level of the conversation is set to AP_CONFIRM_SYNC_LEVEL.

    For more information about confirmation processing, see Confirmation Processing.

Note

Issuing MC_RECEIVE_AND_WAIT while the conversation is in SEND state flushes the LU's send buffer and changes the conversation state to RECEIVE. Changing the conversation state in this manner does not support confirmation processing.

Changing to SEND State

MC_REQUEST_TO_SEND informs the partner TP (for which the conversation is in SEND state) that the local TP (for which the conversation is in RECEIVE state) wants to send data. This request is communicated to the partner TP through the rts_rcvd parameter of MC_CONFIRM. (The rts_rcvd parameter is also returned to MC_SEND_DATA and other verbs.)

When the partner TP issues MC_PREPARE_TO_RECEIVE, the conversation state changes to RECEIVE for the partner TP, making it possible for the local TP to send data.

Note

Issuing MC_REQUEST_TO_SEND does not change the state of the conversation. Upon receiving a request to send, the partner TP is not required to change the conversation state; it can ignore the request.