Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vonderklaas/golang-tcp-server
Go implementation of a TCP server with list of peers tracking.
https://github.com/vonderklaas/golang-tcp-server
go tcp
Last synced: 3 months ago
JSON representation
Go implementation of a TCP server with list of peers tracking.
- Host: GitHub
- URL: https://github.com/vonderklaas/golang-tcp-server
- Owner: vonderklaas
- Created: 2022-06-23T15:08:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-07T07:51:23.000Z (9 months ago)
- Last Synced: 2024-10-27T21:16:52.341Z (3 months ago)
- Topics: go, tcp
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-golang-repositories - golang-crud - capable backend application using Go. The REST API is built using the "gorilla/mux" HTTP Router, and I have integrated the application with a ... (Repositories)
README
### 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
```console
go run main.go
```Spawn as much peers as you want
```console
telnet localhost 3000
```Send your bytes to the server
```console
Hello, world!
```See your messages
```console
...
...
Message from %conn.RemoteAddr()%: Hello, world!
```Receive "ping-pong"
```console
Thank you for your message!
```### References
https://okanexe.medium.com/the-complete-guide-to-tcp-ip-connections-in-golang-1216dae27b5a