本文整理匯總了Golang中misc/packet.Packet類的典型用法代碼示例。如果您正苦於以下問題:Golang Packet類的具體用法?Golang Packet怎麽用?Golang Packet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Packet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GSProxy
//------------------------------------------------ Game Server Request Proxy
func GSProxy(hostid int32, reader *packet.Packet) (ret []byte) {
defer helper.PrintPanicStack()
// read protocol number
b, err := reader.ReadS16()
if err != nil {
log.Println("read protocol error")
return
}
// get handler
handle := protos.ProtoHandler[b]
if handle == nil {
log.Println("service not bind", b)
return
}
// call handler
start := time.Now()
ret = handle(hostid, reader)
end := time.Now()
log.Printf("code: %v %v TIME:%v\n", b, protos.RCode[b], end.Sub(start))
return ret
}
示例2: PKT_user_archives_info
func PKT_user_archives_info(reader *packet.Packet) (tbl user_archives_info, err error) {
tbl.F_id, err = reader.ReadS32()
checkErr(err)
tbl.F_archives, err = reader.ReadString()
checkErr(err)
return
}
示例3: PKT_GETLIST
func PKT_GETLIST(reader *packet.Packet) (tbl GETLIST, err error) {
tbl.F_A, err = reader.ReadS32()
checkErr(err)
tbl.F_B, err = reader.ReadS32()
checkErr(err)
return
}
示例4: PKT_ID_SCORE
func PKT_ID_SCORE(reader *packet.Packet) (tbl ID_SCORE, err error) {
tbl.F_id, err = reader.ReadS32()
checkErr(err)
tbl.F_score, err = reader.ReadS32()
checkErr(err)
return
}
示例5: PKT_MSG
func PKT_MSG(reader *packet.Packet) (tbl MSG, err error) {
tbl.F_id, err = reader.ReadS32()
checkErr(err)
tbl.F_data, err = reader.ReadBytes()
checkErr(err)
return
}
示例6: PKT_atk_player_rst_req
func PKT_atk_player_rst_req(reader *packet.Packet) (tbl atk_player_rst_req, err error) {
tbl.F_rst, err = reader.ReadS32()
checkErr(err)
tbl.F_protect_time, err = reader.ReadS32()
checkErr(err)
return
}
示例7: PKT_seed_info
func PKT_seed_info(reader *packet.Packet) (tbl S_seed_info, err error) {
tbl.F_client_send_seed, err = reader.ReadS32()
checkErr(err)
tbl.F_client_receive_seed, err = reader.ReadS32()
checkErr(err)
return
}
示例8: PKT_error_info
func PKT_error_info(reader *packet.Packet) (tbl S_error_info, err error) {
tbl.F_code, err = reader.ReadS32()
checkErr(err)
tbl.F_msg, err = reader.ReadString()
checkErr(err)
return
}
示例9: PKT_talk
func PKT_talk(reader *packet.Packet) (tbl talk, err error) {
tbl.F_user, err = reader.ReadString()
checkErr(err)
tbl.F_msg, err = reader.ReadString()
checkErr(err)
return
}
示例10: PKT_LIST
func PKT_LIST(reader *packet.Packet) (tbl LIST, err error) {
narr, err2 := reader.ReadU16()
checkErr(err2)
tbl.F_items = make([]ID_SCORE, narr)
for i := 0; i < int(narr); i++ {
tbl.F_items[i], err = PKT_ID_SCORE(reader)
}
return
}
示例11: PKT_LOGIN_ACK
func PKT_LOGIN_ACK(reader *packet.Packet) (tbl LOGIN_ACK, err error) {
tbl.F_success, err = reader.ReadBool()
checkErr(err)
tbl.F_groupmsgmax, err = reader.ReadU32()
checkErr(err)
return
}
示例12: PKT_PROTECT
func PKT_PROTECT(reader *packet.Packet) (tbl PROTECT, err error) {
tbl.F_id, err = reader.ReadS32()
checkErr(err)
tbl.F_protecttime, err = reader.ReadS64()
checkErr(err)
return
}
示例13: PKT_pve_list
func PKT_pve_list(reader *packet.Packet) (tbl pve_list, err error) {
narr, err2 := reader.ReadU16()
checkErr(err2)
tbl.F_items = make([]pve_list_item, narr)
for i := 0; i < int(narr); i++ {
tbl.F_items[i], err = PKT_pve_list_item(reader)
}
return
}
示例14: PKT_pve_list_item
func PKT_pve_list_item(reader *packet.Packet) (tbl pve_list_item, err error) {
tbl.F_id, err = reader.ReadS32()
checkErr(err)
tbl.F_name, err = reader.ReadString()
checkErr(err)
tbl.F_rank, err = reader.ReadS32()
checkErr(err)
tbl.F_state, err = reader.ReadS32()
checkErr(err)
tbl.F_protect_time, err = reader.ReadS32()
checkErr(err)
return
}
示例15: PKT_INFO
func PKT_INFO(reader *packet.Packet) (tbl INFO, err error) {
tbl.F_id, err = reader.ReadS32()
checkErr(err)
tbl.F_state, err = reader.ReadS32()
checkErr(err)
tbl.F_score, err = reader.ReadS32()
checkErr(err)
tbl.F_clan, err = reader.ReadS32()
checkErr(err)
tbl.F_name, err = reader.ReadString()
checkErr(err)
return
}