Sockets instructions
Use the Sockets protocol for Ethernet communications to devices that do not support Modbus TCP and EtherNet/IP. Sockets support client, server, Transmission Control Protocol (TCP), and User Datagram Protocol (UDP). Typical applications include communicating to printers, bar codes readers, and personal computers.
Instruction Processing and Output Updates for Sockets instructions:
- Asynchronous: Respective instructions where all outputs update asynchronously with the user program scan. For example, a ladder scan. Asynchronous output cannot be used for edge trigger detection. Asynchronous output parameters are not forced and can be updated after completing the respective socket instructions.
- Synchronous: Respective instructions where all output update is in sync with user program scans. Synchronous output parameters are forced and cannot be modified after completing the respective socket instruction.
- Hybrid: Respective instructions where a few outputs update in sync with the user program scan. Remaining outputs update asynchronously with user program scan.
- Immediate Instruction Execution: Instruction completes the desired function before going to the next instruction.
- Non-Immediate Instruction Execution: Instruction takes more than one program scan to complete the desired function. Instructions take a snap shot of input parameters when aFalse > Truetransition is detected.
Instruction | Description | TCP Client | TCP Server | UDP with Open | UDP without Open | Instruction Processing | Instruction Output Update |
---|---|---|---|---|---|---|---|
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. | NO | YES | NO | NO | Non-Immediate | Hybrid | |
Creates an instance of the Socket and returns an instance number that uses the next socket operations. | YES | YES | YES | YES | Immediate | Synchronous | |
Deletes a created socket instance. TCP connections are closed prior to deletion. | YES | YES | YES | YES | Non-Immediate | Synchronous | |
Returns information for the socket, such as error codes and execution status. | YES | YES | YES | YES | Immediate | Synchronous | |
TCP connections open with the specified destination address. UDP connections associate a destination IP address and port number with the specified socket. | YES | NO | YES | NO | Non-Immediate | Synchronous | |
Reads data on a socket. Attempts to receive the specified number of bytes and returns the number of bytes received. | YES | YES | YES | YES | Non-Immediate | Hybrid | |
Sends data on a socket. Attempts to send the requested number of bytes and returns the number of bytes sent. | YES | YES | YES | YES | Non-Immediate | Hybrid |
Provide Feedback