|
@ -101,7 +101,7 @@ func (c *Connection) StartReader() { |
|
|
|
|
|
|
|
|
//读取客户端的Msg head
|
|
|
//读取客户端的Msg head
|
|
|
headData := make([]byte, dp.GetHeadLen()) |
|
|
headData := make([]byte, dp.GetHeadLen()) |
|
|
if _, err := io.ReadFull(c.GetTCPConnection(), headData); err != nil { |
|
|
|
|
|
|
|
|
if _, err := io.ReadFull(c.Conn, headData); err != nil { |
|
|
fmt.Println("read msg head error ", err) |
|
|
fmt.Println("read msg head error ", err) |
|
|
break |
|
|
break |
|
|
} |
|
|
} |
|
@ -118,7 +118,7 @@ func (c *Connection) StartReader() { |
|
|
var data []byte |
|
|
var data []byte |
|
|
if msg.GetDataLen() > 0 { |
|
|
if msg.GetDataLen() > 0 { |
|
|
data = make([]byte, msg.GetDataLen()) |
|
|
data = make([]byte, msg.GetDataLen()) |
|
|
if _, err := io.ReadFull(c.GetTCPConnection(), data); err != nil { |
|
|
|
|
|
|
|
|
if _, err := io.ReadFull(c.Conn, data); err != nil { |
|
|
fmt.Println("read msg data error ", err) |
|
|
fmt.Println("read msg data error ", err) |
|
|
break |
|
|
break |
|
|
} |
|
|
} |
|
|