client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	core.Subject[*Packet]
	Open() error
	Write(*Packet) error
	Close()
}

type ClientImplOnRTP

type ClientImplOnRTP struct {
	core.AbstractSubject[[]byte]
	// contains filtered or unexported fields
}

func NewRtpClient

func NewRtpClient(id string, address string) *ClientImplOnRTP

func (*ClientImplOnRTP) Close

func (c *ClientImplOnRTP) Close()

func (*ClientImplOnRTP) Open

func (c *ClientImplOnRTP) Open() error

func (*ClientImplOnRTP) Write

func (c *ClientImplOnRTP) Write(data []byte) error

type Packet

type Packet struct {
	Type PacketType
	Data []byte
}

Packet 连接状态也通过该数据包回调

func NewPacket

func NewPacket(t PacketType, data []byte) *Packet

func (*Packet) ToString

func (p *Packet) ToString() string

type PacketType

type PacketType int
const (
	PacketTypeConnected   PacketType = 0 // 连接成功
	PacketTypeConnectLost PacketType = 1 // 连接断开
	PacketTypeData        PacketType = 2 // 数据包
)

func (PacketType) ToString

func (p PacketType) ToString() string

type TcpClient

type TcpClient struct {
	core.AbstractSubject[*Packet]
	// contains filtered or unexported fields
}

TcpClient TCP客户端

func NewTcpClient

func NewTcpClient(address string) *TcpClient

func (*TcpClient) Close

func (c *TcpClient) Close()

func (*TcpClient) Open

func (c *TcpClient) Open() error

func (*TcpClient) Write

func (c *TcpClient) Write(data *Packet) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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