connect

package
v0.0.0-...-011cc8f Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProtocolVersion int

Functions

This section is empty.

Types

type Connect

type Connect struct {
	Conn     net.Conn
	Host     string
	Port     uint16
	IsOnline bool
	// contains filtered or unexported fields
}

func NewConnect

func NewConnect(host string, port int, isOnline bool, argv ...string) *Connect

*

  • 创建连接
  • argv只传一个参数,则为昵称
  • 传二个则为账号密码

func (*Connect) Close

func (c *Connect) Close()

释放资源

func (*Connect) DealPacket

func (c *Connect) DealPacket(pk *Packet)

处理获取的数据包

func (*Connect) GetProtocolVersion

func (c *Connect) GetProtocolVersion() int

获取协议版本号

func (*Connect) GetStatus

func (c *Connect) GetStatus() string

获取服务器信息

func (*Connect) HandShake

func (c *Connect) HandShake(NextState int) []byte

对服务器握手发送数据进行封装

func (*Connect) HandleBuf

func (c *Connect) HandleBuf()

循环获取服务端发来的数据

func (*Connect) LoginStart

func (c *Connect) LoginStart()

func (*Connect) ReadAll

func (c *Connect) ReadAll() *bytes.Buffer

读取服务器发送过来的数据

func (*Connect) Send

func (c *Connect) Send(bs []byte)

向服务器发送数据

func (*Connect) Start

func (c *Connect) Start()

开始连接并运行

Jump to

Keyboard shortcuts

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