ProU说明   快速入门   指令说明   运动控制   EtherCAT   C语言   可视化   CAD   通讯   PCI控制卡   MECHATROLINK   程序模板   ProH   YKCAT   视觉组件   WinPLC   附录  
上一页 下一页

网络通讯

注意:最大接收和发送的字符长度为1024。

1.TCP

1.1打开

int GC_Eth_Open(int ip, int port)

ip 如配置127.0.0.1
ip_addr = 127 << 24;
ip_addr += 0 << 16;
ip_addr += 0 << 8;
ip_addr += 1 << 0;
port 端口号
返回值 =0打开失败;>0句柄

1.2关闭

int GC_Eth_Close(int handle)

handle 打开时返回的句柄
返回值 >=0关闭成功 <0关闭失败

1.3发送

int GC_Eth_Send(int handle, char *buffer, int len)

handle 打开时返回的句柄
buffer 发送缓冲区
len 待发送的字节数,最大1024字节
返回值 成功发送的字节数

1.4接收

int GC_Eth_Rev(int handle, char *buffer, int len)

handle 打开时返回的句柄
buffer 接收缓冲区
len 待接收的字节数,最大1024字节
返回值 成功接收的字节数

1.5程序示例

点击下载

2.UDP

2.1打开

int GC_Udp_Open(int ip, int port)

ip 如配置127.0.0.1
ip_addr = 127 << 24;
ip_addr += 0 << 16;
ip_addr += 0 << 8;
ip_addr += 1 << 0;
port 端口号
返回值 =0打开失败;>0句柄

2.2关闭

int GC_Udp_Close(int handle)

handle 打开时返回的句柄
返回值 >=0关闭成功 <0关闭失败

2.3发送

int GC_Udp_Send(int handle, char *buffer, int len)

handle 打开时返回的句柄
buffer 发送缓冲区
len 待发送的字节数,最大1024字节
返回值 成功发送的字节数

2.4接收

int GC_Udp_Rev(int handle, char *buffer, int len)

handle 打开时返回的句柄
buffer 接收缓冲区
len 待接收的字节数,最大1024字节
返回值 成功接收的字节数

2.5程序示例

点击下载

3.三菱MC

3.1发送

int GC_Eth_MC_Write(int handle, int sl_elem, int elem_len, int proh_elem)

handle 1.1返回的句柄
sl_elem

三菱元件类型以及起始例如:D123
('D'<<24) | 123

支持元件种类: 'M','B','L','F','S','D','R','W'

elem_len 元件数量,最大256个
proh_elem

ProU元件类型以及起始例如:D123
('D'<<24) | 123

'M':M元件
'B':B元件
'L':L元件
'F':F元件
'S':S元件
'D':D元件
'R':R元件
'V':VD元件
'U':RD元件

返回值 >0 成功

3.2发送

int GC_Eth_MC_Read(int handle, int sl_elem, int elem_len, int proh_elem)

handle 1.1返回的句柄
sl_elem

三菱元件类型以及起始例如:M123
('M'<<24) | 123

支持元件种类: 'M','B','L','F','S','D','R','W'

elem_len 元件数量,最大256个
proh_elem

ProU元件类型以及起始例如:M123
('M'<<24) | 123

'M':M元件
'B':B元件
'L':L元件
'F':F元件
'S':S元件
'D':D元件
'R':R元件
'V':VD元件
'U':RD元件

返回值  

3.3程序示例

MC示例

 

上一页 下一页
Copyright © 2020 深圳市优易控软件有限公司 www.proutech.com