---
title: "How Does a W5500 TCP Server Work with DHCP-Based Network Bring-Up?"
url: "https://maker.wiznet.io/Arnold/projects/how-does-a-w5500-tcp-server-work-with-dhcp-based-network-bring-up/"
markdown_url: "https://maker.wiznet.io/Arnold/projects/how-does-a-w5500-tcp-server-work-with-dhcp-based-network-bring-up/md"
type: "UCC: User Created Content"
author: "Arnold"
author_url: "https://maker.wiznet.io/Arnold/"
original_author: "小蚂蚁2020"
original_url: "https://www.bilibili.com/video/BV1B94y1T7LN/?spm_id_from=333.1387.collection.video_card.click&vd_source=ab013cc5ffdecedae5ee47ae256d7306"
published: "2026-02-13"
language: "en"
likes: 0
views: 407
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# How Does a W5500 TCP Server Work with DHCP-Based Network Bring-Up?

> This article explains how to implement a TCP server using the WIZnet W5500 Ethernet controller in a DHCP-based network environment.

Original author: 小蚂蚁2020 (source: https://www.bilibili.com/video/BV1B94y1T7LN/?spm_id_from=333.1387.collection.video_card.click&vd_source=ab013cc5ffdecedae5ee47ae256d7306)

## Article

## How Does a W5500 TCP Server Work with DHCP-Based Network Bring-Up?

### An Engineer-Grade Walkthrough Using ESP8266 and STM32

**(W5500 TCP 서버는 DHCP 환경에서 어떻게 동작하는가?)**

---

### Summary (40–60 words)

This article explains how to implement a TCP server using the WIZnet W5500 Ethernet controller in a DHCP-based network environment. By walking through network bring-up, router dependency, and TCP server behavior on ESP8266 and STM32 platforms, it clarifies why DHCP is required and how proper initialization enables reliable Ethernet communication.

---

### 1. What “TCP Server on W5500” Really Means

When we say **“W5500 TCP Server”**, we mean:

The embedded device **listens** on a TCP port

A PC, phone, or cloud service **connects to it**

The device responds to incoming data

This is different from:

HTTP clients

MQTT publishers

Cloud-initiated connections

In this model, **the device must be reachable on the local network**.
That requirement drives all network bring-up decisions.

---

### 2. Why a Router and DHCP Are Required in This Scenario

Many beginners ask:

> “Why does this TCP server demo require a router and DHCP?”

The answer is **address discovery and routing**.

#### In a DHCP-Based Network

The router:

Assigns IP addresses

Maintains ARP tables

Acts as the local network authority

The W5500 device:

Requests an IP via DHCP

Receives:

IP address

Subnet mask

Gateway

DNS (optional)

This makes the device **automatically reachable** by other devices on the LAN.

---

#### Without DHCP (Direct Cable Connection)

If you connect:

PC ↔ W5500 directly
without static IP configuration on **both sides**:

No IP is assigned

No routing exists

TCP connections fail silently

This is why **the demo explicitly requires a router with DHCP enabled**.

---

### 3. Network Bring-Up Flow (DHCP vs Static IP)

#### DHCP Bring-Up Flow (Used in This Demo)

`Power on → SPI initialized → W5500 reset → DHCP DISCOVER → Router assigns IP → Network ready → TCP server starts listening `

Advantages:

Zero manual IP configuration

Works in typical home/office networks

Ideal for education and demos

---

#### Static IP Bring-Up Flow (For Comparison)

`Power on → SPI initialized → W5500 reset → Write MAC / IP / Subnet / Gateway → Network ready → TCP server starts listening `

Static IP works **only if**:

IP does not conflict

PC is on the same subnet

For beginners, DHCP is safer.

---

### 4. Role of W5500 in Network Bring-Up

The **W5500** handles:

ARP

IP

TCP state machine

Retransmission

Checksum calculation

The MCU (ESP8266 or STM32) only:

Configures registers

Reads socket state

Moves data in/out of buffers

> **This is why W5500 is ideal for learning TCP server concepts without drowning in protocol details.**

---

### 5. ESP8266 vs STM32: Same Concept, Different MCUs

#### ESP8266

Often used in education

Wi-Fi capable, but Ethernet via W5500 is deterministic

Good for demonstrating TCP server basics

#### STM32

Common in industrial products

Precise timing

Clean SPI control

Long-term stability

**Key point:**
The **W5500 TCP server logic is identical** on both platforms.

---

### 6. TCP Server Socket Lifecycle on W5500

#### Conceptual Socket State Flow

`CLOSED → OPEN → LISTEN → ESTABLISHED → DATA RX / TX → CLOSE `

Important rules:

Socket must be in `LISTEN` to accept connections

Only one client per socket

RX buffer must be drained

RECV must be issued after reading data

Most TCP server bugs happen **here**, not in DHCP.

---

### 7. Typical TCP Server Data Flow

#### RX Path

`Client sends data → W5500 RX buffer receives it → RX size register updated → MCU reads RX buffer → MCU processes data → MCU issues RECV `

#### TX Path

`MCU prepares response → Write to TX buffer → Update TX pointer → SEND command → W5500 transmits response `

Failure to manage RX/TX pointers correctly results in:

One-time success

Then “no data received” symptoms

---

### 8. Common Beginner Mistakes (And Why They Happen)

#### ❌ “TCP server doesn’t respond”

Cause:

Device never got a valid IP (DHCP failed)

#### ❌ “Client connects once, then fails”

Cause:

RX buffer not released (RECV missing)

#### ❌ “Works on router, not direct cable”

Cause:

No static IP configuration on PC

These are **network bring-up issues**, not TCP problems.

---

### 9. Educational Value of This Demo

This demo is valuable because it teaches:

Real TCP server behavior

Role of routers and DHCP

Difference between link-up and IP-ready

How embedded devices become discoverable

It avoids:

Complex cloud protocols

Hidden software stacks

Black-box behavior

---

### 10. Engineer Takeaway

> **A W5500 TCP server is not just about sockets — it is about correct network identity and reachability.**

DHCP + router:

Solve IP management

Reduce configuration errors

Make demos reproducible

This is why **DHCP is required in this educational setup**.

---

### FAQ (Engineer-Grade)

**Q1. Can I use static IP instead of DHCP?**
Yes, but you must configure both device and PC correctly.

**Q2. Is a router mandatory for TCP server?**
Only if you rely on DHCP. Static IP can work without it.

**Q3. Does W5500 implement DHCP?**
No. DHCP client logic runs on the MCU.

**Q4. Is this suitable for industrial products?**
Yes. Many products start with DHCP, then move to static IP.

**Q5. Does ESP8266 vs STM32 change TCP behavior?**
No. TCP behavior is handled by W5500 hardware.

---

### Source

Bilibili video: **BV1ek4y1s7fL**

WIZnet W5500 Datasheet

---

### Tags

W5500, TCP Server, DHCP, ESP8266, STM32, Network Bring-Up, Embedded Ethernet, Education

---

---

## 🇰🇷 한국어 번역 (1:1 Full Translation)

---

## W5500 TCP 서버는 DHCP 환경에서 어떻게 동작하는가?

### ESP8266과 STM32를 활용한 엔지니어 관점 네트워크 브링업 설명

---

### 요약

본 문서는 WIZnet W5500을 사용해 TCP 서버를 구현할 때 DHCP 기반 네트워크 환경이 왜 필요한지를 설명한다. ESP8266과 STM32 플랫폼을 예로 들어, 네트워크 브링업, 라우터 의존성, TCP 서버 소켓 동작을 단계적으로 분석한다.

---

### 1. TCP 서버의 의미

TCP 서버는
연결을 기다리는 쪽이다.

---

### 2. DHCP가 필요한 이유

라우터는
IP를 배포하고
네트워크를 성립시킨다.

---

### 3. 브링업 흐름

DHCP → IP 획득 → LISTEN

---

### 4. W5500의 역할

TCP/IP는
하드웨어가 처리한다.

---

### 5. 흔한 실수

IP 미할당

RECV 누락

라우터 없이 연결

---

### 6. 핵심 메시지

> **W5500 TCP 서버의 핵심은 소켓이 아니라 네트워크 도달성이다.**

---

### 태그

W5500, TCP 서버, DHCP, ESP8266, STM32, 네트워크 브링업, 임베디드 이더넷

---

Source: https://maker.wiznet.io/Arnold/projects/how-does-a-w5500-tcp-server-work-with-dhcp-based-network-bring-up/
