TcpIsValid
Description
This function block tests if a socket is valid.
Figure 8-221: The TcpIsValid function block
Related Functions
TcpAccept, TcpBinReceive, TcpBinSend, TcpClose, TcpConnect, TcpIsConnected, TcpListen, TcpReceive, TcpSend
Arguments
Input
Execute | Description | On the rising edgeA rising edge is the transition of a digital signal from low to high. It is also called positive edge request to perform copying a file |
Data Type | BOOL | |
Range | 0, 1 | |
Unit | N/A | |
Default | — | |
ID | Description | The ID of the client socket. |
Data Type | UDINT | |
Range | N/A | |
Unit | N/A | |
Default | — |
Output
Done | Description | If TRUE, then the command completed successfully |
Data Type | BOOL | |
Error | Description | If TRUE, an error has occurred |
Data Type | BOOL | |
ErrorID | Description | Indicates the error if Error output is set to TRUE. See the table in Search IndexFile and TCP/IP Function Block ErrorID Output |
Data Type | DINT | |
Valid | Description | TRUE if the specified socket is still valid. |
Data Type | BOOL |
Example
Structured Text
(* TcpIsValid example *)
CASE StepCounter OF
0:
Inst_TcpIsValid(TRUE, MySocketID);
StepCounter := StepCounter + 1;
1:
Inst_TcpIsValid(TRUE, MySocketID);
IF Inst_TcpIsValid.Done THEN
MyTcpIsValid := Inst_TcpIsValid.Valid;
Inst_TcpIsValid(FALSE, 0);
StepCounter := StepCounter + 1;
END_IF;
END_CASE;