Mitsubishi Electronics MELSEC Q series MELSEC L series Home Theater Server User Manual


 
7.8 SOCRMODE Instruction
7-23
7
SOCKET COMMUNICATION
FUNCTION INSTRUCTION
SP_SOCRMODE
SP_SOCRMODE
Control Data
*1: Unavailable for a UDP connection.
Precautions
(1) Use the Built-in Ethernet port QCPU of which the function version is B or later and the first
five digits of the serial number are '11012' or higher.
(2) Use the LCPU other than L02SCPU and L02SCPU-P.
Program Example
The following program changes the receive mode of the connection number 1 to TCP fixed
length receive mode and changes its receive data length to 256 bytes.
After instruction execution, the connection number 1 turns the receive status signal ON when the
length of receive data reaches 256 bytes.
[Structured ladder/FBD]
[ST]
IF (Var_Flag_Inst=TRUE) THEN
MOVP(TRUE, 1, Var_ControlData[2]); (* Sets TCP receive mode to 1 *)
MOVP(TRUE, 256, Var_ControlData[3]); (* Sets receive data size to 256 *)
SP_SOCRMODE(TRUE, "00", 1, Var_ControlData);
(*Changes the receive mode of the connection number 1 *)
END_IF;
Device Item Setting data Setting range Setting side
[0]
System area

[1]
Completion status
The instruction application status is stored.
0 : Normal completion
Other than 0 : Error completion (error code)
System
[2]
TCP Receive Mode
*1
Specify the TCP receive mode.
0 : TCP normal receive mode
1 : TCP fixed length receive mode
0, 1 User
[3]
Receive Data Size
Specify the receive data size of the socket communication. (number of
bytes)
1 to 2046 User
s2
s2
s2
s2
Sets TCP receive
mode to 1
Sets receive
data size to 256
Changes the receive
mode of the
connection number 1