SOCKET_INFO

The SOCKET_INFO instruction returns information for a socket instance, such as error codes and execution status. Outputs update synchronously from the program scan.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the L20E, L50E, and L70E controllers.
SOCKET_INFO
SOCKET_INFO
SOCKET_INFO parameters
Parameter
Parameter Type
Data Type
Execute
Input
BOOL
Instruction block enable.
  • TRUE: Rising Edge detected; start the instruction block with the precondition that the last operation has been completed.
  • FALSE: No Rising Edge detected.
Instance
Input
UDINT
Copy the returned Socket Handler from a SOCKET_CREATE or SOCKET_ACCEPT instruction to delete the respective socket.
  • For UDP and TCP Client Socket types, copy the returned Socket Handler from a SOCKET_CREATE instruction.
  • For TCP Server socket type, copy the returned Socket Handler from a SOCKET_ACCEPT instruction.
When Instance is 0, returns a summary of all Socket Instances.
ClrDiagCnt
Input
BOOL
  • TRUE: Clear Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) Diagnostics counter information.
  • FALSE: No clearing of TCP or UDP counter information.
Such as TCP and UDP, OtherInfo Array Index 1 to 6.
When Instance is 0, clear OtherInfo Array Index 7 to 14.
Done
Output
BOOL
Indicates when operation is complete.
  • TRUE: Operation completed successfully.
  • FALSE: Operation is in progress or encountered an error condition.
Output is updated synchronously from the program scan.
Busy
Output
BOOL
  • TRUE: The operation is not finished.
  • FALSE: The operation is finished.
Output is updated synchronously from the program scan.
Error
Output
BOOL
Indicates an error occurred.
TRUE: An error is detected.
FALSE: No error. 
Output is updated synchronously from the program scan.
Status
Output
SOCK_STATUS
Status is defined using the SOCK_STATUS data type which contains ErrorID, SubErrorID, and StatusBits information.
Output is updated synchronously from the program scan.
SocketType
Output
USINT
Socket Instance type:
  • 0 - Not used
  • 1 - TCP
  • 2 - UDP
When Socket_Info Instance is 0, SocketType displays as 0.
StreamType
Output
USINT
Socket Stream type:
  • 0 - None
  • 1 - TCP Server
  • 2 - TCP Client
When Socket_Info Instance is 0, StreamType displays as 0.
TxQueCnt
Output
USINT
Number of Tx messages currently in the queue.
When Socket_Info Instance is 0, TxQueCnt displays as 0.
RxQueCnt
Output
USINT
Number of Rx messages currently in the queue.
When Socket_Info Instance is 0, RxQueCnt displays as 0.
SocketState
Output
USINT
Socket Instruction State information. For more information refer to Socket State Machine.
When Socket_Info Instance is 0, SocketState displays as 0.
LocalAddr
Output
SOCKETADDR_CFG
Local address for the socket. For more information refer to SOCKADDR_CFG data type.
When Socket_Info Instance is 0, LocalAddr displays as 0.
RemoteAddr
Output
SOCKETADDR_CFG
Remote address for the socket. For more information refer to SOCKADDR_CFG data type.
RemoteAddr displays as 0, in the following cases:
  • Socket_Info Instance is 0.
  • User Datagram Protocol (UDP) connections  without SOCKET_OPEN.
  • UDP with SOCKET_OPEN and disabled RxFilter.
OtherInfo
UDINT[1..15]
Socket Instance configured as TCP, Array Index Description is:
  • 1 - Packet Sent: Total number of TCP Packets sent on a Socket.
  • 2 - Bytes Sent: Total number of TCP bytes sent on a Socket.
  • 3 - Packet Received: Total number of TCP packets received on a Socket.
  • 4 - Bytes Received: Total number of TCP bytes received on a Socket.
  • 5 - Retransmit Packets: Total number of TCP packet retransmissions.
  • 6 - Checksum Errors: Total number of TCP Packets with Checksum errors on a Socket.
  • 7 - TCP State: Current state of a Socket.
  • (8 to 11) - OtherInfo is not supported for TCP, displays as 0.
  • 12 ,13,14,15 - Displays as 0.
Socket Instance configured as UDP, Array Index Description is:
  • 1 - Packet Sent: Total number of UDP packets sent on a Socket.
  • 2 - Bytes Sent: Total number of UDP bytes sent on a Socket.
  • 3 - Packet Received: Total number of UDP packets received on a Socket.
  • 4 - Bytes Received: Total number of UDP bytes received on a Socket.
  • 5 - Packets Dropped: Total number of UDP received packets dropped for a Socket due to exceeding the maximum queue size limit of 8.
  • 6 - Checksum Errors: Total number of UDP packets with checksum errors on Socket.
  • 7 to 15 - Display as 0.
Socket Instance configured as 0, Array Index Description is:
  • 1 - Count for Socket Instance Available. Maximum number of sockets supported.
  • 2 - Count for Socket Instance Used. Number of sockets created successfully.
  • 3 - Number of Socket instances created as TCP.
  • 4 - Number of socket instances created as TCP Client.
  • 5 - Number of socket instances created as TCP Server.
  • 6 - Number of Socket instances created as UDP.
  • 7 - SOCKET_READ Success count when Socket Instance is configured as TCP.
  • 8 - SOCKET_WRITE Success count when Socket Instance is configured as TCP.
  • 9 - SOCKET_READ Failure count when Socket Instance is configured as TCP.
  • 10 - SOCKET_WRITE Failure count when Socket Instance configure as TCP.
  • 11 - SOCKET_READ Success count when Socket Instance configure as UDP.
  • 12 - SOCKET_WRITE Success count when Socket Instance configure as UDP.
  • 13 - SOCKET_READ Failure count when Socket Instance configure as UDP.
  • 14 - SOCKET_WRITE Failure count when Socket Instance configure as UDP.
  • 15 - Display as 0.

SOCKET_INFO examples

SOCKET_INFO function block diagram example
SOCKET_INFO function block diagram example
SOCKET_INFO ladder diagram example
SOCKET_INFO ladder diagram example
SOCKET_INFO structured text example
SOCKET_INFO structured text example
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal