tcp

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	C_read_buf_size  = 4096
	C_max_write_size = 4096
	C_qw_max_size    = 10000
)

Variables

This section is empty.

Functions

func Connect

func Connect(addr string, timeout int32, f func(err error, sock *Socket))

Types

type ConnectQ

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

func NewConnectQ

func NewConnectQ() *ConnectQ

func (*ConnectQ) Close

func (self *ConnectQ) Close()

func (*ConnectQ) Connect

func (self *ConnectQ) Connect(f func(done func()), delay int32)

func (*ConnectQ) Open

func (self *ConnectQ) Open()

type Server

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

func CreateServer

func CreateServer() *Server

func (*Server) Listen

func (self *Server) Listen(addr string) *Server

func (*Server) OnConnection

func (self *Server) OnConnection(f func(sock *Socket)) *Server

func (*Server) OnError

func (self *Server) OnError(f func(err error)) *Server

func (*Server) Stop

func (self *Server) Stop()

type Socket

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

func (*Socket) Close

func (self *Socket) Close()

func (*Socket) HeartBeat

func (self *Socket) HeartBeat(ms uint32)

func (*Socket) OnClose

func (self *Socket) OnClose(f func())

func (*Socket) OnData

func (self *Socket) OnData(f func(buf []byte))

func (*Socket) RemoteAddr

func (self *Socket) RemoteAddr() string

func (*Socket) RemoteIP

func (self *Socket) RemoteIP() string

func (*Socket) RemotePort

func (self *Socket) RemotePort() int32

func (*Socket) Send

func (self *Socket) Send(buf []byte)

func (*Socket) TcpNoDelay

func (self *Socket) TcpNoDelay(b bool)

Jump to

Keyboard shortcuts

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