https://github.com/antomfdez/golit
This repository implements a simple TCP listener in Go that listens for incoming connections on a specified port and prints the received data.
https://github.com/antomfdez/golit
Last synced: 4 months ago
JSON representation
This repository implements a simple TCP listener in Go that listens for incoming connections on a specified port and prints the received data.
- Host: GitHub
- URL: https://github.com/antomfdez/golit
- Owner: antomfdez
- License: mit
- Created: 2024-10-26T17:23:07.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-29T18:28:15.000Z (8 months ago)
- Last Synced: 2025-01-10T22:35:38.448Z (5 months ago)
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golit
This repository implements a simple TCP listener in Go that listens for incoming connections on a specified port and prints the received data. It also includes graceful shutdown functionality to handle termination signals (`Ctrl+C`) cleanly.
**Features:**
- Accepts incoming TCP connections on a user-defined port.
- Reads data from connected clients.
- Prints received data to the console.
- Handles `Ctrl+C` gracefully by closing connections before exiting.**Requirements:**
- Go 1.17 or later ([https://go.dev/](https://go.dev/))
**Getting Started:**
1. Clone this repository:
```bash
git clone https://github.com/antomfdez/golit.git
```2. Navigate to the project directory:
```bash
cd golit
```3. Run the listener:
```bash
go run ./cmd/golit -p 8080
```- Replace 8080 with your desired port number.
**Usage:**- The script accepts a single optional flag:
- -p: The port number on which to listen (default: 8080).
## License
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).