Socket Send
This block sends data through an established socket connection. Use it for TCP/IP communication with remote servers or devices.

Overview
The Socket Send block transmits data over TCP/IP socket connections, enabling custom protocol implementations and direct network communication.
Configuration
- Socket Connection: Which socket connection to use
- Data: Message or data to send
- Format: Text, binary, or hex encoding
Data Format
Send data in various formats:
Text/String
Plain text messages with encoding (UTF-8, ASCII)
Binary
Raw binary data for efficient protocols
Hexadecimal
Hex-encoded data for debugging and specific protocols
Use Cases
Common socket send scenarios:
- Send Modbus TCP requests
- Custom protocol commands
- Database queries
- API requests
- Device control commands
- Binary file transfers
Message Preparation
Prepare data before sending:
- Format strings with variables
- Construct binary packets
- Calculate checksums
- Add protocol headers
- Encode data appropriately
Buffer Management
Socket send buffers data:
- Automatic buffering for large messages
- Non-blocking operation
- Queue management
- Flow control
Error Handling
Handle send failures:
- Connection closed: Reconnect required
- Buffer full: Wait or reduce send rate
- Timeout: Check network latency
- Format error: Verify data encoding
Use On Socket Event to monitor errors.
Performance
Optimize socket transmission:
- Batch small messages
- Use binary format for efficiency
- Monitor buffer usage
- Implement flow control
Related Blocks
- Socket Connect: Establish connection
- On Socket Data: Receive responses
- On Socket Event: Monitor connection status
- Variable Set: Prepare data
Protocol Implementation
Implement custom protocols:
- Connect to remote server
- Send protocol handshake
- Wait for response
- Send commands/queries
- Process responses
- Close connection when done
Security
Secure socket communication:
- Use TLS/SSL sockets
- Validate server certificates
- Encrypt sensitive data
- Implement authentication