Skip to content

TCP server from scratch in Go with peers list tracking.

Notifications You must be signed in to change notification settings

vonderklaas/golang-tcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description

This code is a minimal and runnable example of establishing a TCP server connection in Go.
The application listens for incoming connections on :3000 and prints out data received from the client.
Additionally, it maintains a dynamic list of connected peers and displays their unique IDs along with their respective network addresses.

Quick Start

Start server

go run main.go

Spawn as much peers as you want

telnet localhost 3000

Send your bytes to the server

Hello, world!

See your messages

...
...
Message from %conn.RemoteAddr()%: Hello, world!

Receive "ping-pong"

Thank you for your message!

References

https://okanexe.medium.com/the-complete-guide-to-tcp-ip-connections-in-golang-1216dae27b5a

About

TCP server from scratch in Go with peers list tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages