當前位置: 首頁>>代碼示例>>Golang>>正文


Golang iobuffer.NewOutBuffer函數代碼示例

本文整理匯總了Golang中github.com/colefan/gsgo/netio/iobuffer.NewOutBuffer函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewOutBuffer函數的具體用法?Golang NewOutBuffer怎麽用?Golang NewOutBuffer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewOutBuffer函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: EncodePacket

func (this *RoleStatusReq) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
開發者ID:colefan,項目名稱:gsgo-hgame,代碼行數:7,代碼來源:login.go

示例2: EncodePacket

func (this *LoginResp) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.RandomCode)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
開發者ID:dulumao,項目名稱:gsgo,代碼行數:8,代碼來源:login.go

示例3: EncodePacket

func (this *ProxyClientOfflineResp) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.UserID)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
開發者ID:dulumao,項目名稱:gsgo,代碼行數:8,代碼來源:proxy.go

示例4: EncodePacket

func (this *ServerErrorNt) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.ReqCmdID)
	buf.PutRawValue(this.ErrCode)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
開發者ID:dulumao,項目名稱:gsgo,代碼行數:9,代碼來源:comm.go

示例5: EncodePacket

func (this *InitTimeStampNt) EncodePacket(nLen int) *iobuffer.OutBuffer {
	buf := iobuffer.NewOutBuffer(nLen)
	buf = this.Packet.Header.Encode(buf)
	buf.PutRawValue(this.TimeStamp)
	buf.PutRawValue(this.SyncCode)
	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)
	return buf
}
開發者ID:colefan,項目名稱:gsgo-hgame,代碼行數:9,代碼來源:init.go

示例6: Encode

func (h *Header) Encode(writeBuf *iobuffer.OutBuffer) *iobuffer.OutBuffer {
	if writeBuf == nil {
		writeBuf = iobuffer.NewOutBuffer(1024)
	}
	writeBuf.PutUint16(h.PackLen)
	writeBuf.PutUint16(h.CmdID)
	writeBuf.PutUint32(h.ID)
	writeBuf.PutUint16(h.FSID)
	writeBuf.PutUint16(h.TSID)
	writeBuf.PutUint16(h.ValidCode)
	writeBuf.PutUint8(h.Version)
	writeBuf.PutUint8(h.ClientSrc)
	writeBuf.PutUint16(h.ErrCode)
	return writeBuf
}
開發者ID:dulumao,項目名稱:gsgo,代碼行數:15,代碼來源:packet.go

示例7: HandleMsg

func (this *MyClient) HandleMsg(cmdid uint16, pack *packet.Packet, conn netio.ConnInf) {
	//fmt.Println("[C]...read a msg, id = ", cmdid)
	buf := iobuffer.NewOutBuffer(int(pack.PackLen + packet.PACKET_PROXY_HEADER_LEN))
	buf = pack.Header.Encode(buf)
	for _, tmp := range pack.RawData {
		buf.PutByte(tmp)
	}

	nPackLen := buf.GetLen() - packet.PACKET_PROXY_HEADER_LEN
	buf.SetUint16(uint16(nPackLen), 0)

	//	if conn != nil {
	//		conn.Write(buf.GetData())
	//	}
}
開發者ID:dulumao,項目名稱:gsgo,代碼行數:15,代碼來源:gameclient.go


注:本文中的github.com/colefan/gsgo/netio/iobuffer.NewOutBuffer函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。