
ESP32-S3 board
The brain — today it joins your network and listens.
ESP32-S3 Lab · Day 30 of 30
Day thirty — the last leg. The ESP32-S3 joins your Wi-Fi, opens port 80, and waits for your computer to dial in. When a line you type on one machine appears on the other, your board has become what this course promised on day one: a device on the network, with an address, a door, and something to say.
TSK-DAY30-TCPIP
Hand this to an agent so it can pull the lesson packet and coach you step by step.
01 First, know the pieces
Three things on the bench, plus one download for your computer — Processing, which arrives in the steps. Tap Define on anything unfamiliar; the answer opens as a field note you can read and dismiss without losing your place.

The brain — today it joins your network and listens.

Uploads the sketch and opens Serial Monitor.

Sketch_24.2_WiFiServer.ino
02 One action at a time
All the wiring days led here — today the path is code, one download, and a conversation across your own network. Tap each step as you go to keep your place.
Open Sketch_24.2_WiFiServer.ino in Arduino IDE.
Replace the two ******** placeholders with your own Wi-Fi name and password — the same network your computer is on.
On your computer, install Processing from processing.org/download.
In Processing, add the ControlP5 library — Sketch → Import Library → Add Library, then search ControlP5.
Back in the sketch folder, open the bundled sketchWiFi/sketchWiFi.pde in Processing and click Run.
Upload the Arduino sketch, then open Serial Monitor at 115200 and watch the board join your network and print its IP address and port 80.
In sketchWiFi, choose TCP CLIENT mode, enter the board's printed IP and port 80, and connect.
Type a line in sketchWiFi and press Enter — it lands in Serial Monitor. Answer from Serial Monitor's send box — it lands in sketchWiFi.
03 Read just enough code
The sketch does two jobs. setup() joins your Wi-Fi as a station, prints the address the router assigned, and starts the server; loop() is a relay, carrying each line from the network to the monitor and each line from the monitor to the network. Switch to MicroPython to see the same idea in raw sockets.
#define port 80
WiFiServer server(port);
WiFi.begin(ssid_Router, password_Router);
server.begin(port);
WiFiClient client = server.accept(); // listen for incoming clients
Serial.println(client.readStringUntil('\n')); // print it out the serial monitor
client.print(Serial.readStringUntil('\n')); // print it out the client.
WiFi.begin(ssid_Router, password_Router)Joins your router's network as a station — the router hands the board an IP address. server.begin(port)Starts listening at port 80 — a numbered door other machines can knock on. client.print(Serial.readStringUntil('\n'))Reads the line you typed in Serial Monitor and sends it down the network to the computer. Optional side path · no wiring
port = 8000 #input the remote port
listenSocket = socket.socket()
listenSocket.bind((ip,port))
listenSocket.listen(1)
print ('tcp waiting...')
conn,addr = listenSocket.accept()
print(addr,"connected")
conn.send('I am Server')
listenSocket.bind((ip,port))Ties the listening socket to the board's own address and to port 8000.conn.send('I am Server')The first line down the wire the moment a client connects.Raw sockets this time, and port 8000 where the C sketch uses 80 — dial whichever port the running code printed. Run it in Thonny if MicroPython is set up; otherwise skip it — it should never block the Arduino-first day.
04 Understand, don't memorise
Yesterday the board earned an address on your network. Today it puts that address to work and holds a real conversation with another machine. Every connection on the internet — every page you load, every message you send — is the same four-beat exchange you are about to run entirely inside your own router.
In station mode the board joins your Wi-Fi and the router hands it an IP address — its number on the network, printed to Serial Monitor for you to copy.
Calling server.begin() makes the board wait at port 80 — a numbered door at that address. Ports are how one machine can host many services at once, each behind its own door.
Your computer takes the client role. It dials the exact IP and port the monitor printed, the board accepts, and the two are now joined.
Once joined, both ends read and write the same stream of bytes. TCP re-sends anything that goes missing and hands each side the bytes in the order they were sent, so you just watch whole lines of text arrive intact.
server listens at an address and port → client dials that address and port → one reliable stream, in order, both ways
Yesterday the board joined the network and the router handed it a number. Today it opens a door at that number and offers a service that answers when dialled — an address, a port, and something listening.
Networks drop and shuffle pieces of data all the time. TCP hides that for you — it numbers each chunk, re-sends anything that goes missing, and reassembles them in order before your code ever sees them. You read clean text in the right sequence, and every web server in the world leans on exactly this.
A port is a number that picks which service you mean at an address. The board answers on 80 here, while other ports could serve other things — which is how a single machine hosts many services at once without them getting tangled.
05 Know it worked
Success and recovery sit side by side, so you never have to go hunting when something looks off.
Your address will differ — always dial the one your monitor just printed. The middle lines are whatever the two machines say to each other.
06 Make the idea yours
One last experiment, and it needs nothing but the phone in your pocket. A web browser is a TCP client — the same role sketchWiFi just played. Point one at your board, watch the two talk, then teach the board to answer on its own. It fits inside today's 30 minutes, and it closes the course.
On your phone, joined to the same Wi-Fi, open a browser and go to http:// followed by the board's printed IP address. The browser dials port 80 — exactly what sketchWiFi did — and the request it sends lands in Serial Monitor as a line beginning GET /. Your phone just spoke to your board the way it speaks to any website.
With the browser still waiting, type a line into Serial Monitor's send box and press Enter — it travels back down the same connection to your phone. Then, in the sketch, check each incoming line and have the board client.print("aye\n") whenever the line contains "ahoy". A two-word protocol that answers on its own, and it's yours.
07 Learn it with a hand on the tiller
Every lesson ships with a code and a machine-readable packet, so an agent can guide you with full context.
TSK-DAY30-TCPIP
How the agent should behave: guide one step at a time, wait for you to confirm, explain terms on request, and check credentials, the 2.4 GHz band, and the printed IP before changing code.
Keep your place
Mark it complete — it shows on your course map, and your place is saved on this device.