15
- KV-EP21V/KV-8000/KV-7500/KV-5500/KV-NC1EP 用户手册 -
第 14 章 KV 套接字通信功能
14-1 关于 KV 套接字通信 ( 仅 KV-8000/7500) ..........................................................14-2
KV 套接字通信功能概述 ....................................................................................................14-2
何谓套接字.........................................................................................................................14-2
关于 KV 套接字通信中使用的端口号 .................................................................................14-3
关于 TCP/IP 和 UDP/IP 的区别 .........................................................................................14-3
关于数据的收发 .................................................................................................................14-5
“单元编辑器”下的设定项目 ................................................................................................14-9
在KV套接字通信功能中使用的继电器和缓冲存储器........................................................14-10
KV-8000/7500和KV-5000的套接字通信差分 ...................................................................14-12
14-2 基于 TCP/IP 的通信 ........................................................................................14-13
连接的建立.......................................................................................................................14-13
通信流程 ..........................................................................................................................14-14
TCP 被动打开处理步骤....................................................................................................14-15
TCP 主动打开处理步骤....................................................................................................14-16
TCP 发送处理步骤...........................................................................................................14-17
TCP 接收处理步骤...........................................................................................................14-19
TCP 关闭处理步骤...........................................................................................................14-21
基于 TCP(有协议)通信时的样例程序 ............................................................................14-23
基于 TCP(无协议)通信时的样例程序 ............................................................................14-28
14-3 基于 UDP/IP 的通信........................................................................................14-34
通信流程 ..........................................................................................................................14-34
UDP 打开处理步骤 ..........................................................................................................14-35
UDP 发送处理步骤 ..........................................................................................................14-36
UDP 接收处理步骤 ..........................................................................................................14-37
UDP 关闭处理步骤 ..........................................................................................................14-38
基于 UDP 通信时的样例程序...........................................................................................14-39
14-4 KV 套接字通信用单元专用指令.......................................................................14-43
单元专用指令一览............................................................................................................14-43
U_SOPEN 打开设定.........................................................................................14-44
U_SWRBUF 发送数据写入 .................................................................................14-46
U_SRDBUF 接收数据读出 .................................................................................14-48
U_SSTAT 处理状态读出 .................................................................................14-50
U_SRCVNP TCP (无协议)接收设定 ..............................................................14-52
U_SUDPTO UDP 通信目标写入.........................................................................14-54
14-5 KV 套接字通信用单元专用函数.......................................................................14-57
单元专用函数一览............................................................................................................14-57
U_SOPEN 打开设定.........................................................................................14-58
U_SWRBUF 发送数据写入 .................................................................................14-59
U_SRDBUF 接收数据读出 .................................................................................14-60
U_SSTAT 处理状态读出 .................................................................................14-61
U_SRCVNP TCP (无协议)接收设定 ..............................................................14-62
U_SUDPTO UDP 通信目标写入.........................................................................14-63
U_SOPEN 打开设定.........................................................................................14-64
U_SWRBUF 发送数据写入 .................................................................................14-66
U_SRDBUF 接收数据读出 .................................................................................14-67
U_SSTAT 处理状态读出 .................................................................................14-69
U_SRCVNP TCP (无协议)接收设定 ..............................................................14-70
U_SUDPTO UDP 通信目标写入.........................................................................14-71