跳到主要内容

4. 数据流示例

以下示例说明了某些较常见操作在客户端和服务器之间的数据流. 这些示例旨在展示逻辑记录在客户端和服务器之间发送的顺序以及这些记录的内容. 图中显示了客户端和服务器之间交换的记录的十六进制表示. 客户端实现各种操作的方式会因实现而异, 此处不讨论这些细节. 在这些示例中, 当字段的值取决于特定逻辑记录的屏幕数据长度时, 将表示为 'LLLL'.

4.1 查询设备示例​

服务器系统可以发送 Query 命令, 以确定与其通信的设备的属性. 当客户端收到 Query 命令时, 必须将 Query Reply 发送回服务器. 有关 Query 命令和 Query Reply 格式的完整描述, 请参见第 5 节.

Server: Sends Write Structured    001112A0 00000400 000304F3 0005D970
Field Query command. 00FFEF

Client: Responds with a Query 004712A0 00000400 00000000 88003AD9
Reply, in this case, 70800600 01030000 00000000 00000000
for a 3180-2. 00000000 00000001 F3F1F8F0 F0F0F202
00000061 50000100 00000018 11000000
00000000 000000FF EF

4.2 取消邀请示例​

当服务器需要反转正常的数据流方向时, 将发送 Cancel Invite. 当客户端收到 Cancel Invite 时, 应当回复一个 Cancel Invite, 并且在服务器再次"邀请"工作站之前不发送任何用户数据. 当服务器向客户端发送读命令时, 称工作站已被"邀请". Cancel Invite 流程如下:

Server: Sends header with the     000A12A0 00000400 000AFFEF
Opcode = Cancel Invite.

Client: Sends header with the 000A12A0 00000400 000AFFEF
Opcode = Cancel Invite
to indicate that the
work station is no
longer invited.

4.3 系统请求示例​

当客户端希望中断服务器作业以执行某些功能时, 将调用 5250 System Request 操作. 典型场景是用户按下系统请求键, 或映射到系统请求键的任何按键, 这将导致客户端 Telnet 发起以下流程:

Client: Sends header with the     000A12A0 00000404 0000FFEF
System Request bit set.

注意: 客户端可以在此记录的头部之后包含用户数据. 服务器会将此数据解释为要从系统请求菜单中选择的选项. 如果是这种情况, 服务器将不会发送系统请求菜单, 流程将根据所选选项继续. 在此示例中, 客户端不发送任何用户数据, 流程将如下继续:

Server: Sends header with the     000A12A0 00000400 000AFFEF
Opcode = Cancel Invite.

Client: Sends header with the 000A12A0 00000400 000AFFEF
Opcode = Cancel Invite
to indicate that the
work station is no
longer invited.
Server: Sends Save (Immediate)    000C12A0 00000400 00040402 FFEF
command with
Opcode = Save Screen.

Client: Sends the screen image LLLL12A0 00000400 00040412
to be saved. <Screen Image> FFEF

Server: Sends System Request LLLL12A0 00000400 0003
menu with <System Request Menu> FFEF
Opcode = Put/Get.

Client: Sends User Input to LLLL12A0 00000400 0000
the Sys Req menu. <User Input> FFEF

注意: 接下来发生什么将取决于用户选择的 System Request 选项. 在任何 System Request 处理完成后, 服务器将继续执行以下恢复操作:

Server: Sends the saved           LLLL12A0 00000400 00050412
screen to be restored, <Saved Screen> FFEF
Opcode = Restore Screen.

(客户端无需回复)

Server: Sends Read Modified       000E12A0 00000400 00010452 0000FFEF
Data Tag (MDT) command,
opcode = Invite.

此时, 客户端将"邀请"工作站, 并进入按下 System Request 键之前所处的状态.