Skip to content

spike83/tcp-echo-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCP Echo Server

Docker Pulls License

TCP Echo Server is a simple echo server written in Golang that works plainly over the TCP protocol. The server listens to connection requests, prepends a preconfigured prefix to the data it receives from a client and writes it back on the connection.

Deploy Locally

To start the TCP Echo Server locally, simply run the following command.

$ go run -v main.go 9000 hello
command-line-arguments
listening on [::]:9000, prefix: hello

Deploy Over Docker

To run the TCP Echo Server container, simply execute the following command.

$ docker run -p 9000:9000 venilnoronha/tcp-echo-server:latest
listening on [::]:9000, prefix: hello

Manual Test

To test the TCP Echo Server, run the following command.

$ echo world | nc localhost 9000
hello world

Unit Test

To run the unit test, execute the following command.

$ go test -v ./...
=== RUN   TestTcpEchoServer
listening on [::]:9000, prefix: hello
request: world
response: hello world
--- PASS: TestTcpEchoServer (2.01s)
PASS
ok  	github.com/venilnoronha/tcp-echo-server	2.015s

License

The TCP Echo Server project is distributed under the BSD-style license found in the LICENSE file.

About

A simple TCP Echo Server written in Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 83.9%
  • Dockerfile 16.1%