tcp

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tcp provides a TCP server implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect added in v1.2.0

func Connect(addr string) (net.Conn, error)

Connect returns a new TCP connection.

Types

type Handler

type Handler interface {
	Serve(conn net.PacketConn)
}

Handler handles TCP connections.

type Server

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

Server serves TCP connections.

func NewServer

func NewServer(h Handler) (*Server, error)

NewServer returns a server with the given handler.

func (*Server) Listen

func (s *Server) Listen(ctx context.Context, addr string) error

Listen listens to an address for new connections, passing them off to the handler in a goroutine.

Jump to

Keyboard shortcuts

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