This project is a basic TCP server implemented in Go.
- Listens on a TCP port (
:3000
) - Accepts multiple client connections
- Reads messages sent by clients
- Sends back a confirmation response
main.go
: Entry point of the servernewServer.go
: Defines the Server struct and constructoraccept.go
: Handles incoming connectionsread.go
: Reads messages from clientsstart.go
: Starts the server and manages shutdown
go run main.go
Make sure your server is running, then open a new terminal and connect using:
telnet localhost 3000
Once connected, type a message and press Enter. You should receive:
Thank you for message!
Server log output will look like:
Started at :3000
new connection to the server 127.0.0.1:50432
received message from connection(127.0.0.1:50432): hello server