![Omron Sysmac NY512-1300 User Manual Download Page 277](http://html.mh-extra.com/html/omron/sysmac-ny512-1300/sysmac-ny512-1300_user-manual_742451277.webp)
9-19
9 Socket Service
NY-series Industrial Panel PC / Industrial Box PC Built-in EtherNet/IP Port User’s Manual (W563)
9-
6 Det
ails on
Usin
g t
h
e Soc
ket Services
9
9-6-
4 UDP Sample Pro
gramming
In this sample, the UDP socket service is used for data communications between the NY-series Con-
troller and a remote node.
The processing procedure is as follows:
1
The SktUDPCreate instruction is executed to request creation of a UDP socket.
2
Execute the SktUDPSend instruction to request sending. The data in
SendSocketDat[]
is sent.
3
The SktUDPRcv instruction is executed to request reception. The receive data is stored in
RcvSocketDat[].
4
The SktClose instruction is executed to close the socket.
ST
*1 Replace the variable name with
_EIP1_EtnOnlineSta
(Port1 Online) or
_EIPIn1_EtnOnlineSta
(Internal Port1
Online), depending on which communications port you use.
9-6-4
UDP Sample Programming
Internal
Variables
Variable
Data type
Initial value
Comment
Trigger
BOOL
False
Execution condi-
tion
DoSendAndRcv
BOOL
False
Processing
Stage
INT
0
Status change
RcvSocketDat
ARRAY[0..1999] OF
BYTE
[2000(16#0)]
Receive data
WkSocket
_sSOCKET
(Handle:=0,
SrcAdr:=(PortNo:=0, IpAdr:=’’),
DstAdr:=(PortNo:=0, IpAdr:=’’))
Socket
SendSocketDat
ARRAY[0..1999] OF
BYTE
[2000(16#0)]
Send data
SktUDPCreate_instance
SktUDPCreate
SktUDPSend_instance
SktUDPSend
SktUDPRcv_instance
SktUDPRcv
SktClose_instance
SktClose
External
Variables
Variable
Data type
Constant
Comment
_EIP_EtnOnlineSta
*1
BOOL
Online
IP address: 192.168.250.1
UDP port number: 6000
Ethernet line
Built-in EtherNet/IP port
Data received.
Remote node
IP address: 192.168.250.2
UDP port number: 6001
Data sent.
Summary of Contents for Sysmac NY512-1300
Page 459: ......