tcp

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PauseAll

func PauseAll(servers []*Server)

func StopAll

func StopAll(servers []*Server)

func WaitAll

func WaitAll(servers []*Server)

Types

type Client

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

func NewClient

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

type Deadliner

type Deadliner interface {
	SetDeadline(t time.Time) error
}

type OnConn

type OnConn func(net.Conn)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(sock net.Listener, onConn OnConn) *Server

func (*Server) Pause

func (s *Server) Pause()

Pause stops listening to new connections, however doesn't close the socket.

func (*Server) Start

func (s *Server) Start() error

Start runs the accept-loop until an error during accepting the connection happens or graceful shutdown invokes

func (*Server) Stop

func (s *Server) Stop() error

Stop closes the server socket, however all the clients won't be notified explicitly until they try to send us anything

func (*Server) Wait

func (s *Server) Wait()

Wait blocks the caller until all the connections are closed

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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