---
title: "tinygo w5500 TCP echo server"
url: "https://maker.wiznet.io/Aimee0/projects/tinygo-w5500-tcp-echo-server/"
markdown_url: "https://maker.wiznet.io/Aimee0/projects/tinygo-w5500-tcp-echo-server/md"
type: "UCC: User Created Content"
author: "Aimee"
author_url: "https://maker.wiznet.io/Aimee0/"
original_author: "Aimee"
original_url: "https://github.com/toyo/tinygo-w5500/tree/main"
published: "2024-01-02"
language: "en"
likes: 0
views: 399
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# tinygo w5500 TCP echo server

> This is an example of implementing a TCP echo server and a client using the W5500 driver written as TinyGo.

Original author: Aimee (source: https://github.com/toyo/tinygo-w5500/tree/main)

## Documents and links

- [tinygo-w5500](https://github.com/toyo/tinygo-w5500/tree/main) (code)

## Article

This is an example of implementing a TCP echo server and a client using the W5500 driver written as TinyGo.

**What is TinyGo?**

A lightweight version of the Go programming language, a project that provides compilers and runtime to enable Go code execution on small embedded systems and web assembly platforms.

- Support embedded Systems and IoT

- Garbage Collection

- Web Assembly Script and WASM (Wasm) support

- Standard Library Support

#main.go

```plaintext
func main() {

	machine.SPI0.Configure(machine.SPIConfig{})

	time.Sleep(3 * time.Second)

	d, err := w5500.NewW5500(machine.SPI0, machine.D3,
		wiznet.IP{192, 168, 50, 55}, wiznet.IP{255, 255, 255, 0}, wiznet.IP{192, 168, 50, 1},
		[]byte{1, 2, 3, 4, 5, 6})

	if err != nil {
		fmt.Println(err)
		time.Sleep(24 * 60 * 60 * time.Second)
		return
	}

	fmt.Println(d.ShowStatus()) // show like `FullDup 100Mbps LinkUp`

	go tcpEchoServer(d, 5555) // Run echo server on port 5555

	tcpTerminalClient(d, &wiznet.TCPAddr{IP: wiznet.IP{192, 168, 50, 3}, Port: 7}) // 7 is echo

	time.Sleep(24 * 60 * 60 * time.Second)
}
```

---

Source: https://maker.wiznet.io/Aimee0/projects/tinygo-w5500-tcp-echo-server/
