Skip to content
a very simple & convenient tcp server framework
Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example first commit Jul 26, 2019
LICENSE
README.md
go.mod first commit Jul 26, 2019
go.sum
tcpserver.go

README.md

tcpserver

Installation

$: go get github.com/x-mod/tcpserver

Quick Start

import (
    "net"
    "log"
	"context"
	"github.com/x-mod/tcpserver"
)

func EchoHandler(ctx context.Context, con net.Conn) error {
    //TODO LOGIC
    return nil
}

func main() {
	srv := tcpserver.NewServer(
		tcpserver.Network("tcp"),
		tcpserver.Address("127.0.0.1:8080"),
		tcpserver.Handler(EchoHandler),
	)
	if err := srv.Serve(context.TODO()); err != nil {
		log.Println("tcpserver failed:", err)
	}
}

More Details, Pls check the example.

You can’t perform that action at this time.