![background image](http://html1.mh-extra.com/html/omron/sysmac-nx1p2-10-1-series/sysmac-nx1p2-10-1-series_user-manual_1633435375.webp)
SktClose_instance(Execute:=FALSE); // Initialize instance.
END_IF;
IF (DoSendAndRcv=TRUE) THEN
CASE Stage OF
1 : // Request to create a s
ocket
SktUDPCreate_instance(
Execute :=TRUE,
SrcUdpPort :=UINT#6001, // Local UDP port number
Socket =>WkSocket); // Socket
IF (SktUDPCreate_instance.Done=TRUE) THEN
Stage :=INT#2; // Normal end
ELSIF (SktUDPCreate_instance.Error=TRUE) THEN
Stage :=INT#10; // Error end
END_IF;
2 : // Receive request
SktUDPRcv_instance(
Execute :=TRUE,
Socket :=WkSocket, // Socket
TimeOut :=UINT#0, // Timeout value
Size :=UINT#2000, // Receive data size
RcvDat :=RcvSocketDat[0]); // Receive data
IF (SktUDPRcv_instance.Done=TRUE) THEN
Stage :=INT#3; // Normal end
ELSIF (SktUDPRcv_instance.Error=TRUE) THEN
Stage :=INT#20; // Error end
END_IF;
3 : // Send request
WkSocket.DstAdr.PortNo :=UINT#6000;
WkSocket.DstAdr.IpAdr :='192.168.250.1';
SktUDPSend_instance(
Execute :=TRUE,
Socket :=WkSocket, // Socket
SendDat :=SendSocketDat[0], // Send data
Size :=UINT#2000); // Send data size
IF (SktUDPSend_instance.Done=TRUE) THEN
Stage :=INT#4; // Normal end
ELSIF (SktUDPSend_instance.Error=TRUE) THEN
Stage :=INT#30; // Error end
END_IF;
9 Socket Service
9-21
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-4
UDP Sample Programming
Содержание Sysmac NX1P2-10 1 Series
Страница 8: ...Manual Structure 6 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Страница 34: ...Revision History 32 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Страница 174: ...6 Testing Communications 6 4 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Страница 354: ...8 CIP Message Communications 8 92 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Страница 388: ...9 Socket Service 9 34 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Страница 394: ...10 Modbus TCP Master Function 10 6 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Страница 430: ...12 FTP Client 12 14 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Страница 569: ...I Index I 1 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506 I...
Страница 576: ...Index I 8 NJ NX series CPU Unit Built in EtherNet IP Port User s Manual W506...
Страница 577: ......