Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IMsgPack ¶
type IMsgPack interface { // Get the head length of the message package. GetHeadLen() uint32 // Pack returns bytes stream packed from a message. Pack(Imessage) (uint32, error) // Unpack returns a message from bytes stream. Unpack() (Imessage, error) }
IMsgPack is an interface that defined a packager, which carries HeadLen, and provides Pack() and Unpack() method.
type Imessage ¶
Imessage is an interface that definds a message, which carries DataLen, MsgId and MsgData.
type Message ¶
Message implements Imessage.
func NewMessage ¶
NewMessage returns a message typed *Message.
func (*Message) GetDataLen ¶
GetDataLen returns DataLen typed uint32.
func (*Message) GetMsgData ¶
GetMsgData returns Data typed []byte.
type MsgPack ¶
type MsgPack struct {
// contains filtered or unexported fields
}
MsgPack implements the interface IMsgPack, carrying HeadLen and conn for Pack() and Unpack().
func NewMsgPack ¶
NewMsgPack returns a packager *MsgPack.
func (*MsgPack) GetHeadLen ¶
GetHeadLen return HeadLen of the message.
Click to show internal directories.
Click to hide internal directories.