Closed FunkyYang closed 3 months ago
server version: fdfs_trackerd V6.12.1 fdfs_storaged V6.12.1
see the issue: #703
t.storageInfo.port = bytesToInt(getBytesByPosition(buf, 31, 8))
log.Printf("%d", t.storageInfo.port)
//bytesToInt 字节转换成整形
// @bys 需要转换的字节
func bytesToInt(bys []byte) int64 {
bytesBuffer := bytes.NewBuffer(bys)
// 注意:这里转换的结果是 : 8字节整数
var x int64
_ = binary.Read(bytesBuffer, binary.BigEndian, &x)
return x
}
// getBytesByPosition 截取指定长度的字节切片
// @bys 原始字节切片
// @start 开始位置,
// @num 截取的字节数目
func getBytesByPosition(bys []byte, start, num int) []byte {
var newBytes = bys[start:]
endPosition := bytes.IndexByte(newBytes, 0x0)
if endPosition > 0 {
num = endPosition
}
return newBytes[:num]
}
and print will be 0
t.storageInfo.port = bytesToInt(getBytesByPosition(buf, 31, 8)) 31 should changed to 61,as: t.storageInfo.port = bytesToInt(getBytesByPosition(buf, 61, 8))
yes ,solved
receive from server response,the protocol format may be error,
and print
I don't see port param in reponse ?why?