tcp

package
v2.3.1-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunTCPServer

func RunTCPServer(sock net.Listener, onConn onConnection, sd chan struct{}) error

RunTCPServer is an accept-loop with a support of graceful shutdown. Graceful shutdown can be initialized by sending a notifier into the sd chan. In this case accept-loop still will wait for a connection, but after it'll be accepted RunTCPServer will wait for all the connections to be closed, returning status.ErrShutdown error in a result

Types

type Client

type Client interface {
	Read() ([]byte, error)
	Unread([]byte)
	Write([]byte) error
	Remote() net.Addr
	Close() error
}

func NewClient

func NewClient(conn net.Conn, timeout time.Duration, buff []byte) Client

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL