Tcp Sample Programming - Omron sysmac NX102-9 Series Owner's Manual

Machine automation controller, cpu unit built-in ethernet/iptm port
Table of Contents

Advertisement

9 Socket Service
9-6-5

TCP Sample Programming

In this sample, the TCP socket service is used for data communications between the NJ/NX-series
Controller and a remote node.
IP address: 192.168.250.1
TCP port number: Automatically assigned.
Built-in EtherNet/IP Port
The processing procedure is as follows:
1
The SktTCPConnect instruction is executed to request connecting to the TCP port on the
remote node.
2
The SktClearBuf instruction is executed to clear the receive buffer for a TCP socket.
3
The SktGetTCPStatus instruction is executed to read the status of a TCP socket.
4
The SktTCPSend instruction is executed to request sending data. The data in SendSocketDat[]
is sent.
5
The SktTCPRcv instruction is executed to request receiving data. The receive data is stored in
RcvSocketDat[].
6
The SktClose instruction is executed to close the socket.
ST
Internal
Variables
External
Variables
9-24
IP address: 192.168.250.2
TCP port number: 6000
Data sent.
Data received.
Ethernet line
Variable
Data type
Trigger
BOOL
DoTCP
BOOL
Stage
INT
RcvSocketDat
ARRAY[0..1999] OF
BYTE
WkSocket
_sSOCKET
SendSocketDat
ARRAY[0..1999] OF
BYTE
SktTCPConnect_
SktTCPConnect
instance
SktClearBuf_instance
SktClearBuf
SktGetTCPStatus_
SktGetTCPStatus
instance
SktTCPSend_instance
SktTCPSend
SktTCPRcv_instance
SktTCPRcv
SktClose_instance
SktClose
Variable
Data type
*1
BOOL
_EIP_EtnOnlineSta
NJ/NX-series CPU Unit Built-in EtherNet/IP Port User's Manual (W506)
Remote node
Initial value
False
False
0
[2000(16#0)]
(Handle:=0,SrcAdr:=(PortNo:=0,
IpAdr:=''), DstAdr:=(PortNo:=0,
IpAdr:=''))
[2000(16#0)]
Constant
Comment
Execution condition
Processing
Status change
Receive data
Socket
Send data
Comment
Online

Advertisement

Table of Contents
loading

Table of Contents