tcp_client

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BinaryType byte = iota
	StringType
)
View Source
const MaxPacketSize uint32 = 10 << 20 // 10MBytes

Variables

View Source
var ErrMaxPacketSize = errors.New("maximum packet size exceeded")

Functions

func RunTcp

func RunTcp(tcpServerUrl string)

Types

type Binary

type Binary []byte

func (*Binary) Bytes

func (b *Binary) Bytes() []byte

func (*Binary) ReadFrom

func (b *Binary) ReadFrom(r io.Reader) (int64, error)

func (*Binary) String

func (b *Binary) String() string

func (*Binary) WriteTo

func (b *Binary) WriteTo(w io.Writer) (int64, error)

type Client

type Client struct {
	Conn         net.Conn
	Server       *Server
	Name         string
	LastTimeSeen time.Time
}

type Payload

type Payload interface {
	io.ReaderFrom
	io.WriterTo
	Bytes() []byte
	String() string
}

type Server

type Server struct {
	Address string // Address to open connection: localhost:9999
}

type String

type String string

func (*String) Bytes

func (s *String) Bytes() []byte

func (*String) ReadFrom

func (s *String) ReadFrom(r io.Reader) (int64, error)

func (*String) String

func (s *String) String() string

func (*String) WriteTo

func (s *String) WriteTo(w io.Writer) (int64, error)

Jump to

Keyboard shortcuts

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