CAPL学习-SOME/IP交互层-TCP处理类函数

TCP Handling

SomeIpCloseEstablishedTCPConnection

CAPL 函数 >> 以太网 >> SOME/IP IL >> SomeIpCloseEstablishedTCPConnection

函数功能

关闭一个或多个数据库中定义的 TCP 连接。

语法
capl 复制代码
dword SomeIpCloseEstablishedTCPConnection();                  // 形式 1  
dword SomeIpCloseEstablishedTCPConnection(dword aepHandle);   // 形式 2  
dword SomeIpCloseEstablishedTCPConnection(dword aepHandle, dword remoteIPv4Address);  // 形式 3  
dword SomeIpCloseEstablishedTCPConnection(dword aepHandle, dword remoteIPv4Address, dword remotePort);  // 形式 4  
dword SomeIpCloseEstablishedTCPConnection(dword aepHandle, byte remoteIPv6Address[]);  // 形式 5  
long SomeIpCloseEstablishedTCPConnection(dword aepHandle, byte remoteIPv6Address[], dword remotePort);  // 形式 6  
long SomeIpCloseEstablishedTCPConnection(dword aepHandle, IP_Endpoint remoteIPEndpoint);  // 形式 7  
形式说明
  • 形式 1:关闭本节点(作为 TCP 客户端)的所有 TCP 连接。
  • 形式 2:关闭 TCP 客户端的所有 TCP 连接。
  • 形式 3/5:关闭 TCP 客户端与特定 TCP 服务器的所有 TCP 连接。
  • 形式 4/6:关闭 TCP 客户端与特定 TCP 服务器的 TCP 连接。

TCP 连接可通过 SomeIpEstablishTCPConnection 函数建立。

参数说明
  • aepHandle:发起连接的源应用端点,必须在数据库中定义。
  • remotePort:可发送和接收消息的端口。
  • remoteIPv4Address :需关闭连接的 IPv4 地址,可通过 IPGetAddressAsNumber 函数转换。
  • remoteIPv6Address :需关闭连接的 IPv6 地址,可通过 IpGetAddressAsArray 函数转换。
  • remoteIPEndpoint :IP_Endpoint 类型对象,包含远程端点的地址和端口。
返回值
  • 0:函数执行成功。
  • >0:错误代码。
可用性
版本 支持形式 限制范围 测量配置 仿真/测试配置
11.0 SP3 形式 1-6 以太网 --- •
12.0 SP2 形式 7 以太网 --- •
示例
capl 复制代码
variables  
{  
  dword aep;  // 应用端点句柄  
}  

on start  
{  
  // 句柄需关联数据库中有效的应用端点  
  aep = SomeIpOpenLocalApplicationEndpoint(IP_Endpoint(TCP:192.168.1.1:40000));  
}  

on key 'o'  
{  
  // 建立到特定端点的连接  
  if (SomeIpEstablishTCPConnection(aep, IP_Endpoint(TCP:192.168.1.2:50000)) != 0)  
  {  
    write("连接未建立");  
  }  
}  

on key 'c'  
{  
  // 关闭节点上下文中的所有连接  
  if (SomeIpCloseEstablishedTCPConnection() == 0)  
  {  
    write("连接已关闭");  
  }  
}  

SomeIpEstablishTCPConnection

CAPL 函数 >> 以太网 >> SOME/IP IL >> SomeIpEstablishTCPConnection

函数功能

建立一个或多个数据库中定义的 TCP 连接。

语法
capl 复制代码
dword SomeIpEstablishTCPConnection();                  // 形式 1  
dword SomeIpEstablishTCPConnection(dword aepHandle);   // 形式 2  
dword SomeIpEstablishTCPConnection(dword aepHandle, dword remoteIPv4Address);  // 形式 3  
dword SomeIpEstablishTCPConnection(dword aepHandle, dword remoteIPv4Address, dword remotePort);  // 形式 4  
dword SomeIpEstablishTCPConnection(dword aepHandle, byte remoteIPv6Address[]);  // 形式 5  
long SomeIpEstablishTCPConnection(dword aepHandle, byte remoteIPv6Address[], dword remotePort);  // 形式 6  
long SomeIpEstablishTCPConnection(dword aepHandle, IP_Endpoint remoteIPEndpoint);  // 形式 7  
形式说明
  • 形式 1:建立本节点(作为 TCP 客户端)的所有 TCP 连接。
  • 形式 2:建立 TCP 客户端的所有 TCP 连接。
  • 形式 3/5:建立 TCP 客户端与特定 TCP 服务器的所有 TCP 连接。
  • 形式 4/6:建立 TCP 客户端与特定 TCP 服务器的 TCP 连接。

TCP 连接可通过 SomeIpCloseEstablishedTCPConnection 函数关闭。

参数说明
  • aepHandle:发起连接的源应用端点,必须在数据库中定义。
  • remotePort:可发送和接收消息的端口。
  • remoteIPv4Address :需建立连接的 IPv4 地址,可通过 IPGetAddressAsNumber 函数转换。
  • remoteIPv6Address :需建立连接的 IPv6 地址,可通过 IpGetAddressAsArray 函数转换。
  • remoteIPEndpoint :IP_Endpoint 类型对象,包含远程端点的地址和端口。
返回值
  • 0:函数执行成功。
  • >0:错误代码。
可用性
版本 支持形式 限制范围 测量配置 仿真/测试配置
11.0 SP3 形式 1-6 以太网 --- •
12.0 SP2 形式 7 以太网 --- •
示例
capl 复制代码
variables  
{  
  dword aep;  // 应用端点句柄  
}  

on start  
{  
  // 句柄需关联数据库中有效的应用端点  
  aep = SomeIpOpenLocalApplicationEndpoint(IP_Endpoint(TCP:192.168.1.1:40000));  
}  

on key 'o'  
{  
  // 建立到特定端点的连接  
  if (SomeIpEstablishTCPConnection(aep, IP_Endpoint(TCP:192.168.1.2:50000)) != 0)  
  {  
    write("连接未建立");  
  }  
}  

on key 'c'  
{  
  // 关闭节点上下文中的所有连接  
  if (SomeIpCloseEstablishedTCPConnection() == 0)  
  {  
    write("连接已关闭");  
  }  
}  

SomeIpTCPListen

CAPL 函数 >> 以太网 >> SOME/IP IL >> SomeIpTCPListen

函数功能

监听此 TCP 应用端点。

语法
capl 复制代码
long SomeIpTCPListen(dword aepHandle)  
参数说明
  • aepHandle:应用端点。
返回值
  • 0:函数执行成功。
可用性
版本 限制范围 测量配置 仿真/测试配置
11.0 SP3 以太网 --- •
示例

相关推荐
优化Henry37 分钟前
LTE 载波频率与频点配置详解
运维·网络·学习·5g·信息与通信
xiaomu001231 小时前
高湿环境床垫湿度管理技术框架:湿度阈值、排湿结构与材料选型
经验分享·学习·学习方法
zhangrelay1 小时前
ROS项目设计案例智能大模型正经乱答案例
linux·笔记·学习·ubuntu·机器人
probex_1 小时前
学习笔记:知识图谱是什么,在测试里能干什么
笔记·学习·知识图谱
Lancker2 小时前
chnroute-linux — 中国大陆 IP 段每日自动更新 + 「仅允许国内访问」落地
linux·运维·tcp/ip
每天题库4 小时前
危险货物道路运输从业资格证题库刷题重点与错题梳理
学习·安全·考试·题库·考证
m4Rk_5 小时前
【论文阅读】Agent 记忆机制(86):Skill-Pro——用 Non-Parametric PPO 将交互经验演化为可复用技能
论文阅读·人工智能·学习·开源·github
AOI小白新手上路5 小时前
从 Keil 调试视角看 51 指针,到 Cortex-M 内存映射访问寄存器 · 学习笔记
笔记·学习
Zelman5 小时前
协议栈数据流全景分析
网络协议·tcp/ip·https
别动我齐刘海5 小时前
简历技术栈全面复习——UDP / TCP / CAN / ZMQ / Protobuf 通信工程
网络·c++·python·tcp/ip·机器学习·udp·github