Siemens S7-300 TCP Communication Without S7 Connection Limits
Overview
Engineers integrating an S7-300 CPU or a CP 343-1 with a large PC fleet quickly hit the S7 connection resource ceiling. A CPU 317-2 PN/DP allows 32 connection resources in total, while a CP 343-1 communication processor caps at 16 fully-specified S7 connections. A standard task — pulling status data from one PLC into 20 engineering PCs, or pushing 20 SCADA clients at the same controller — exhausts that budget immediately if every link is configured as a classic S7 connection.
Siemens provides three documented paths to bypass the connection accounting:
- Open User Communication (T blocks) on a CPU with an integrated PROFINET interface — uses raw TCP/UDP sockets and does not consume S7 connection resources.
- Dynamic connection configuration at runtime with FB 55 IP_CONFIG — lets the S7 program build and tear down ISO-on-TCP connections without pre-projected partners.
- Stacked CP 343-1 modules — splits the connection load across multiple PROFINET/Industrial Ethernet interfaces so each CP stays inside its 16/32 connection budget.
This reference details each path, the supported hardware, the FB/FC call patterns, the project configuration steps in STEP 7 V5.x and TIA Portal, and the diagnostics used to verify that connection resources are not being silently consumed.
S7-300 Ethernet Connection Resources Explained
Every S7-300 CPU and every CP that terminates Ethernet connections maintains a finite pool of "connection resources" — internal slots that track the partner, port, transport selector, and active state of each S7 or ISO-on-TCP relationship. The pool is consumed the moment a connection is configured in HW Config, regardless of whether the program actively uses it.
| Module | Order Number (example) | Connection Resources | Notes |
|---|---|---|---|
| CPU 315-2 PN/DP | 6ES7315-2EH14-0AB0 | 16 | 2 reserved for PG/OP; 14 free for S7/open comm partners |
| CPU 317-2 PN/DP | 6ES7317-2EK14-0AB0 | 32 | 2 reserved for PG/OP; 30 free |
| CPU 319-3 PN/DP | 6ES7319-3FL01-0AB0 | 32 | 2 reserved for PG/OP; 30 free |
| CP 343-1 LEAN | 6GK7343-1CX10-0XE0 | 8 S7 + 4 unspecified | Limited for small topologies |
| CP 343-1 | 6GK7343-1EX21-0XE0 | 16 S7 + 16 unspecified | EX21 generation supports extra unspecified slots |
| CP 343-1 Advanced | 6GK7343-1GX31-0XE0 | 32 | Includes web server, FTP, IT functions |
Two connection classes exist on the CP 343-1 EX21 family:
- Fully-specified S7 connection: The partner IP address, rack, and slot are configured in HW Config. Either side can initiate and either side can read/write.
- Unspecified S7 connection: No partner is configured. The CP accepts any incoming connection request from a partner that knows its own slot and rack. Data transfer is typically one-directional (server-only fetch or write).
For a one-way polling scenario (PC reads data from PLC), Siemens permits mixing the two classes: 16 fully-specified outgoing connections can coexist with 4 unspecified incoming connections, yielding exactly the 20 simultaneous links a typical SCADA fleet requires. This is documented for the CP 343-1 EX21 in the SIMATIC NET manual set.
Solution 1 — Open User Communication with T Blocks
The T blocks are part of the "Open Communication Services" runtime that ships inside PN CPUs. They open raw TCP or UDP sockets through the integrated PROFINET interface and never instantiate an S7 connection, so connection resources remain untouched. The blocks are delivered with STEP 7 V5.5 and TIA Portal V13+ under Libraries > Communication Blocks > Open User Communication.
T Block Reference
| FB/FC | Name | Purpose | Protocol |
|---|---|---|---|
| FB 65 | T_CONFIG | Build/teardown TCP/UDP connection at runtime | TCP/UDP |
| FB 66 | T_DIAG | Read connection state and error code | TCP/UDP |
| FB 67 | T_USEND | Send datagram | UDP |
| FB 68 | T_URCV | Receive datagram | UDP |
| FB 8 | T_SEND | Send data block over established TCP socket | TCP |
| FB 9 | T_RECV | Receive data block from established TCP socket | TCP |
Program Structure (TCP server mode)
The PLC acts as the TCP server. Each PC opens a passive connection. The S7 program cyclically calls T_RECV on every configured ID to drain incoming data and T_SEND to push replies.
// OB1 cyclic call — TCP receive on local ID 1
CALL FB 9, DB 109 // T_RECV instance DB
ID := 1 // Local connection ID
LEN := 100 // Max bytes to receive
DATA := P#DB100.DBX0.0 BYTE 100
ADDR := // Not used for TCP
NDR := M100.0 // New data received (one scan)
ERROR := M100.1 // Error flag
STATUS := MW102 // 16-bit status word
// OB1 cyclic call — TCP send on local ID 1
CALL FB 8, DB 108 // T_SEND instance DB
ID := 1
LEN := 50 // Bytes to send
DATA := P#DB200.DBX0.0 BYTE 50
DONE := M110.0
ERROR := M110.1
STATUS := MW112
Program Structure (TCP client mode)
For the more common case where the PLC initiates the connection to each PC, FB 65 T_CONFIG establishes the socket with a dynamic partner IP. This is the open-communication equivalent of an S7 connection configured at runtime.
// One-shot at startup or on change of partner list
CALL FB 65, DB 65 // T_CONFIG instance DB
REQ := TRUE
ID := 1
LEN := 64 // Length of CONFIG parameter block
DONE := M200.0
ERROR := M200.1
STATUS := MW202
CONFIG := P#DB500.DBX0.0 BYTE 64
The CONFIG data block carries a connParam structure describing the protocol (B#16#11 for TCP), the partner IP, and the partner port. The block is fully documented in the entry linked below.
Solution 2 — FB 55 IP_CONFIG (Runtime Connection Setup)
FB 55 IP_CONFIG is delivered with STEP 7 V5.x for S7-300 and S7-400. Unlike the T blocks, IP_CONFIG can project or modify S7 and ISO-on-TCP connections at runtime, but the resources it touches are still drawn from the CP 343-1 pool — so it does not lift the connection ceiling. Its real value is avoiding the rebuild/recertification cycle every time a partner IP changes.
IP_CONFIG Program Pattern
CALL FB 55, DB 55 // IP_CONFIG instance DB
REQ := M300.0 // Trigger pulse
ID := W#16#1 // Connection ID assigned in HW Config
DONE := M300.1
BUSY := M300.2
ERROR := M300.3
STATUS := MW304
CONFIG := P#DB550.DBX0.0 BYTE 64
The CONFIG area carries a IP_V4_CONFIG structure with the new partner IPv4 address, subnet mask, and router. Calling the FB with a new IP commits the change to the CP 343-1 without reloading the S7 program.
For the full FB 55 interface description and CONFIG structure layout, see the official Siemens support entry:
Siemens Support Entry ID 21988384 — FB 55 IP_CONFIG and T blocks for S7-300/400
When to Choose IP_CONFIG vs T Blocks
| Criterion | FB 55 IP_CONFIG | T Blocks (FB 8/9/65) |
|---|---|---|
| Hardware | CPU 300/400 with any Ethernet CP or PN port | CPU with integrated PN interface only |
| Protocol | S7 / ISO-on-TCP / TCP (runtime-reconfigurable) | TCP / UDP only |
| Connection resources used | Yes — still consumes CP pool | No — uses raw socket layer |
| Partner IP change | At runtime without reload | At runtime without reload |
| Best fit | Fewer than 16/32 partners, IPs not fixed at commissioning | 20+ partners, fixed fleet, want zero S7 load |
Solution 3 — Stack Multiple CP 343-1 Modules
If the application demands S7 connections specifically (PUT/GET on data blocks, rather than TCP streaming) and the hardware slot count allows, mount two CP 343-1 modules on the S7-300 rack. Each carries its own 16/32 resource pool. The two CPs share the same backplane but expose two distinct MAC/IP addresses on the plant network.
Slot and Backplane Rules
- Maximum 4 CPs per S7-300 rack (CP 343-1 family).
- Each CP occupies a free slot; ensure the power budget of the CPU allows the extra 5 V draw (CP 343-1 EX21 draws roughly 700 mA).
- Use distinct IP subnets or VLANs if the partners need to address a deterministic CP (e.g., PC fleet split 10 + 10 across two CPs).
When to Choose Stacked CPs
Pick the stacked-CP approach when the SCADA clients require S7 PUT/GET on DBs rather than a custom TCP protocol, when the application already binds to S7 communication, or when the PN CPU option is unavailable because the CPU was purchased without the PN suffix.
Connection Resource Comparison Matrix
| Approach | Hardware Required | Connection Resources Used | Max Concurrent Partners (typical) | Protocol | Complexity |
|---|---|---|---|---|---|
| T Blocks on PN CPU | CPU 315-2 PN/DP or higher | 0 S7 resources | Limited only by CPU socket count (typically 64) | TCP/UDP | Medium — custom PC-side socket code |
| FB 55 IP_CONFIG + CP 343-1 | Any S7-300 + CP 343-1 | Consumes CP pool | 16 + 16 (EX21) | S7 / ISO-on-TCP | Medium — runtime config data blocks |
| Stacked CP 343-1 x2 | Any S7-300 + 2x CP 343-1 | 32 + 32 (Advanced) | Up to 64 (with Advanced CPs) | S7 / ISO-on-TCP | Low — standard S7 connections |
| CP 343-1 EX21 with mixed classes | Any S7-300 + CP 343-1 EX21 | 16 full + 4 unspecified (one-way only) | 20 | S7 one-direction | Low — HW Config only |
Configuring T Blocks in STEP 7 V5.x
The T blocks and supporting data types live in the standard library Communication Blocks > Open User Communication. Import the FBs into the S7 program and assign instance DBs.
Prerequisites
- STEP 7 V5.5 + SP4 or later
- CPU 315-2 PN/DP (6ES7315-2EH14-0AB0) or higher PN variant
- Firmware on CPU >= V3.2 (PN CPUs older than V3.0 lack T_CONFIG stability)
- NetPro configured with at least one Ethernet subnet on the PN port
Step-by-Step
- Open the S7 project in STEP 7 Manager. Open HW Config and verify the CPU has a PROFINET interface. The PN port must be connected to an Ethernet subnet (right-click the port > Properties > New Subnet).
- Open NetPro. Confirm the CPU's PN port appears with the correct IP address. No S7 connection needs to be created here — T blocks bypass NetPro entirely.
- In the program editor, instantiate FB 65 T_CONFIG, FB 66 T_DIAG, FB 8 T_SEND, and FB 9 T_RECV from Libraries > Standard Library > Communication Blocks > Open User Communication. Let STEP 7 auto-generate instance DBs (DB 65, DB 66, DB 8, DB 9).
- Build a CONFIG data block (e.g., DB 500) with the
TCON_IP_V4structure. SetInterfaceId = B#16#1(PN port),ConnType = B#16#11(TCP), the partner IP, and remote port 2000. - In OB 100 (startup) call T_CONFIG once with REQ=TRUE to establish the socket. In OB 1, cycle-call T_RECV first, then T_SEND on the same ID.
- Compile, download to the CPU, and go online. Right-click the instance DB and select Monitor/Modify to watch STATUS.
Verification
- T_CONFIG returns STATUS = W#16#0000 (DONE=TRUE) on success.
- T_RECV STATUS = W#16#0000 when idle; W#16#0001 with NDR=TRUE on a new frame.
- T_SEND STATUS = W#16#0000 with DONE=TRUE after a successful write.
- Open the CPU's online Information > Communication tab and confirm S7 Connections is still 0 — if it shows N connections, the project is silently consuming resources.
Full T block reference and CONFIG structure are in:
Siemens Support Entry ID 19553230 — Open TCP communication with T blocks
Configuring T Blocks in TIA Portal
TIA Portal V13 SP1+ exposes the same T blocks as system function blocks. The CONFIG structure is generated by a wizard attached to the FB 65 instance.
Prerequisites
- TIA Portal V15.1 or later (recommended V17 for stable T_CONFIG on firmware V3.x)
- CPU 315-2 PN/DP or higher PN CPU with firmware >= V3.2
- Device configuration with PROFINET interface online
Step-by-Step
- Add the CPU to the project. Open Device Configuration, confirm the PROFINET interface has a unique IP and subnet.
- In the project tree, drag Communication > Open User Communication blocks into the program. TIA Portal will create the instance DB and the CONFIG DB automatically.
- Open the T_CONFIG instance DB and use the inspector window Configuration > Connection parameters to enter the partner IP, port, and connection type (TCP active/passive).
- Insert T_SEND and T_RECV on the same connection ID. Wire the DATA pointers to your application DBs.
- Compile and download. Go online with the CPU.
- Use Online > Monitor > T_CONFIG instance DB to confirm STATUS transitions from busy to done with code 0000.
Verification
- In the inspector Diagnostics > Connection status, the T_CONFIG connection should show Established.
- Watch T_RECV.NDR — pulses TRUE one scan per received frame.
- Confirm in Online > Diagnostics > Connection resources that S7 connections remain at 0.
Diagnostics and Status Code Reference
The T blocks return status words in standard Siemens format. The most common codes for T_CONFIG, T_SEND, and T_RECV are listed below.
| STATUS (hex) | Meaning | Remedy |
|---|---|---|
| 0000 | No error / done | Continue normal operation |
| 0001 | New data received (T_RECV only) | Process DATA buffer |
| 7000 | Block idle, no request pending | Trigger REQ for T_CONFIG/T_SEND |
| 7001 | First call, BUSY, awaiting completion | Continue calling with REQ=FALSE |
| 7002 | Subsequent call, BUSY | Continue calling |
| 8085 | LEN parameter out of range | Reduce LEN to <= 8192 bytes (TCP) |
| 8086 | ID parameter invalid | Use IDs allocated by T_CONFIG |
| 80A1 | Connection not established | Check partner reachability, firewall, T_CONFIG status |
| 80A3 | Connection being terminated | Call T_CONFIG again to re-establish |
| 80A7 | Partner closed the connection | Re-arm T_CONFIG with REQ=TRUE |
| 80B4 | TCP connection could not be opened (no listener on partner) | Verify partner socket is listening on the configured port |
| 80C3 | Internal resource error on PN port | Reduce concurrent TCP connections or upgrade CPU firmware |
| 80C4 | Temporary resource bottleneck | Retry; if persistent, reduce send frequency |
Troubleshooting Matrix
| Symptom | Likely Root Cause | Diagnostic Step | Fix |
|---|---|---|---|
| S7 connection count rises after commissioning | T blocks accidentally placed on an S7-configured connection | Open NetPro, count S7 connections | Remove S7 connection, rely on T_CONFIG only |
| T_CONFIG STATUS = 80A1 | Partner not reachable or firewall blocking port | From PC, run telnet <plc_ip> 2000
|
Open TCP port on Windows Firewall; confirm partner socket bound |
| T_RECV never sets NDR | Partner is sending on different port or ID mismatch | Compare CONFIG DB port with PC socket bind | Align ports; verify ID matches T_SEND ID |
| 20 PCs work, 21st fails with STATUS 80C3 | CPU socket pool exhausted | Check CPU firmware limits (typically 8–32 sockets per PN port) | Upgrade CPU firmware or split fleet across two PN interfaces |
| CP 343-1 stops responding after 16 connections | Full-specified S7 pool exhausted | Open HW Config > CP Properties > Connection Resources | Switch some links to unspecified, or add a second CP |
| FB 55 IP_CONFIG returns STATUS 80A1 | Configured ID not in HW Config | Re-check NetPro connection ID table | Create the connection in NetPro with the same ID |
| PC sees PLC but cannot read data | One-direction unspecified connection used bidirectionally | Verify direction flag in connection properties | Use fully-specified S7 or T blocks instead |
Field-Proven Design Notes
- Limit TCP partners per PN CPU: A CPU 315-2 PN/DP allows up to 8 concurrent TCP sockets; a CPU 317-2 PN/DP allows up to 16; a CPU 319-3 PN/DP allows up to 32. These are socket limits, not S7 connection limits — a common source of confusion.
- Avoid mixing T blocks with S7 connections on the same interface if connection accounting matters. S7 connections and T-block sockets live on different layers, but a single CPU firmware bug can cause the OS to charge a T socket against the S7 pool. Always verify with the CPU online diagnostics.
- Use ISO-on-TCP (port 102) only when peers require it. Plain TCP keeps the partner code simple and avoids port 102 collision with SIMATIC Manager routing.
- Keep LEN below 8192 for T_SEND/T_RECV. Larger payloads require application-level segmentation and a handshake protocol; the T blocks will reject oversize in one call.
- Always cycle-call T_RECV before T_SEND. This guarantees the receive buffer is drained before new data is sent, preventing receive overrun on the partner side.
- Document every ID: The T block connection ID space is project-local. Keep a spreadsheet mapping ID → partner IP → port → purpose. Lost IDs are difficult to recover without a full re-download.
Related Documentation
For deeper study of the open communication services and the FB 55 IP_CONFIG interface, refer to:
- Siemens Support Entry ID 19553230 — Open Communication with T Blocks (S7-300/400)
- Siemens Support Entry ID 21988384 — FB 55 IP_CONFIG and T_CONFIG Reference
- Siemens Support Entry ID 1861033 — S7-300 Communication Function Blocks Manual
- Siemens Support Entry ID 16873509 — Open User Communication Functions for S7-300
Frequently Asked Questions
Can I use T blocks (T_SEND/T_RECV) on a CPU 315 without the PN suffix?
No. T blocks require an integrated PROFINET interface, so only CPU 315-2 PN/DP, CPU 317-2 PN/DP, CPU 319-3 PN/DP, and all PN S7-400 CPUs support them. A CPU 315 (non-PN) must use AG_SEND/AG_RECV on a CP 343-1, FB 55 IP_CONFIG, or stacked CPs.
Do T-block TCP sockets consume any S7 connection resources on a CPU 317-2 PN/DP?
No. T blocks open raw TCP/UDP sockets through the PN runtime and never instantiate an S7 connection. The 32 connection resources of the CPU 317-2 PN/DP remain fully available for S7-class partners such as HMI panels or other PLCs.
How many concurrent TCP partners can a CPU 317-2 PN/DP handle via T blocks?
The CPU 317-2 PN/DP supports up to 16 concurrent TCP sockets on its PROFINET interface. Each PC client should establish one socket, so a 16-PC fleet is feasible. Larger fleets require firmware that lifts the socket limit (verify against the CPU's firmware release notes) or splitting the load across a second PN interface.
Why does my CP 343-1 EX21 allow 16 full-specified + 4 unspecified S7 connections but no more unspecified slots?
Unspecified S7 connections only support one-directional data transfer. Because the CP must reserve the direction path internally for each unspecified slot, only 4 of the 16 are usable in a mixed configuration where the PLC primarily polls. The remaining 12 unspecified slots can only be deployed if the unspecified connections use a different direction, which is uncommon in production.
Is FB 55 IP_CONFIG a substitute for T blocks?
No. IP_CONFIG lets the S7 program re-project an existing ISO-on-TCP or S7 connection to a new partner IP at runtime, but the connection itself still consumes one of the CP's connection resources. T blocks are the only path to add communication partners without touching the connection pool.
What happens if I exceed the CPU's TCP socket limit?
T_CONFIG returns STATUS = W#16#80C3 (connection resources exhausted) and refuses to open the new socket. Existing sockets are unaffected. Reduce the active partner count, recycle unused sockets by calling T_CONFIG with Mode = B#16#2 (terminate), or upgrade the CPU to a variant with a higher socket limit.