SOCKET_ACCEPT
The SOCKET_ACCEPT instruction is for Transmission Control Protocol (TCP) connections only. Accepts a TCP connection request from a remote destination and returns a Socket Instance used to send and receive data on the newly created connection.
Operation details:
- Before executing Socket_Accept, execute SOCKET_CREATE and specify the local port number for the accept connection.
- Outputs are updated 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_ACCEPT

Parameter | Parameter Type | Data Type | Description |
---|---|---|---|
Execute | Input | BOOL | Instruction block enable.
|
Instance | Input | UDINT | Identifies the socket instance. Copy the returned Socket Handler from the SOCKET_CREATE instruction. |
Timeout | Input | UDINT | Timeout for the SOCKET_ACCEPT instruction block instances. The function block returns an Error if the timeout value is less than the minimum value. Timeout range: 1000-86400000 milliseconds Set Timeout to 0 to use the default value 10000 (10 Second). |
Done | Output | BOOL | Indicates when operation is complete.
Output is updated synchronously from the program scan. |
Busy | Output | BOOL |
Output is updated synchronously from the program scan. |
Error | Output | BOOL | Indicates that an error occurred.
Output is updated synchronously from the program scan. |
Status | Output | SOCK_STATUS | Status is defined using the SOCK_STATUS data type which contains Socket error codes, SubErrorID, and Socket instruction status bits information. Output is updated synchronously from the program scan. |
AcceptInst | Output | UDINT | Contains the Accept Instance for this Socket Instance. Use the unique Accept Instance number with subsequent SOCKET_READ and SOCKET_WRITE for this connection. Output is updated synchronously from the program scan. |
AcceptAddr | Output | SOCKADDR_CFG | A data structure that contains the Accept Address for the socket. For more information, refer to SOCKADDR_CFG data type. To specify an IP address of 192.168.2.100 and Port = 12000:
Output is updated synchronously from the program scan. |
SOCKET_ACCEPT examples
SOCKET_ACCEPT function block diagram example

SOCKET_ACCEPT ladder diagram example

SOCKET_ACCEPT structured text example

Results - TCP server

Provide Feedback