4 : // Request to close the
socket
SktClose_instance(
Execute :=TRUE,
Socket :=WkSocket); // Socket
IF (SktClose_instance.Done=TRUE) THEN
Stage :=INT#0; // Normal end
ELSIF (SktClose_instance.Error=TRUE) THEN
Stage :=INT#40; // Error end
END_IF;
0 : // Normal end
DoSendAndRcv :=FALSE;
Trigger :=FALSE;
ELSE // Interrupted by error.
DoSendAndRcv :=FALSE;
Trigger :=FALSE;
END_CASE;
END_IF;
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.
In this example, programming is also required in the remote node. The order of sending and receiving
is reversed in comparison with the above procedure.
IP address: 192.168.250.1
TCP port number: Automatically assigned.
Ethernet line
Built-in EtherNet/IP Port
Data received.
Remote node
IP address: 192.168.250.2
TCP port number: 6000
Data sent.
Local Node Programming
The processing procedure at the local node is as follows:
1
The SktTCPConnect instruction is used to make a request for connection to the TCP port on
the remote node.
2
The SktClearBuf instruction is used to clear the receive buffer of a TCP socket.
9 Socket Service
9-22
NJ/NX-series CPU Unit Built-in EtherNet/IP Port User’s Manual (W506)
Summary of Contents for Sysmac NX1P2-10 1 Series
Page 8: ...Manual Structure 6 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 34: ...Revision History 32 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 388: ...9 Socket Service 9 34 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 430: ...12 FTP Client 12 14 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 569: ...I Index I 1 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506 I...
Page 576: ...Index I 8 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Page 577: ......