3 The SktGetTCPStatus instruction is used to read the status of the TCP socket.
4 The SktTCPSend instruction is used to make a send request The data in SendSocketDat[] is
sent.
5 The SktTCPRcv instruction is executed to make a receive request. The received data is stored
in RcvSocketDat[].
6 The SktClose instruction is used to close the socket.
ST
Internal
varia-
bles
Variable Data type Initial value Comment
Trigger BOOL False Execution
condition
DoTCP BOOL False Processing
Stage INT 0 Status
change
RcvSocketDat ARRAY[0..1999] OF
BYTE
[2000(16#0)] Received
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
SktTCPConnect_in-
stance
SktTCPConnect
SktClearBuf_instance SktClearBuf
SktGetTCPStatus_in-
stance
SktGetTCPStatus
SktTCPSend_instance SktTCPSend
SktTCPRcv_instance SktTCPRcv
SktClose_instance SktClose
External
variable
Variable Data type Constant Comment
_EIP_EtnOnlineSta
*1
BOOL Online
*1. For an NX701 CPU Unit and an NX102 CPU Unit, replace the variable with _EIP1_EtnOnlineSta (Port1 On-
line) or _EIP2_EtnOnlineSta (Port2 Online), depending on the built-in EtherNet/IP port which is used.
For an NX1P2 CPU Unit, replace the variable with _EIP1_EtnOnlineSta (Port1 Online).
// Start sequence when Trigger changes to TRUE.
IF ((Trigger=TRUE) AND (DoTCP=FALSE) AND (_EIP_EtnOnlineSta=TRUE)) THEN
DoTCP :=TRUE;
Stage :=INT#1;
SktTCPConnect_instance(Execute:=FALSE); // Initialize instance.
SktClearBuf_instance(Execute:=FALSE); // Initialize instance.
9 Socket Service
9-23
NJ/NX-series CPU Unit Built-in EtherNet/IP Port User’s Manual (W506)
9-6 Details on Using the Socket Services
9
9-6-5 TCP Sample Programming