示例#1
0
// Join sends BR_ENTRY packet to the broadcast address
func Join(ipmsg *goipmsg.IPMSG) {
	addr := brAddr(ipmsg)
	cmd := goipmsg.BR_ENTRY
	cmd.SetOpt(goipmsg.BROADCAST)
	err := ipmsg.SendMSG(addr, ipmsg.Myinfo(), cmd)
	if err != nil {
		panic(err)
	}
	fmt.Println("sent BR_ENTRY")
}
示例#2
0
func RECEIVE_BR_ENTRY(cd *goipmsg.ClientData, ipmsg *goipmsg.IPMSG) error {
	Users[cd.Key()] = cd
	ipmsg.SendMSG(cd.Addr, ipmsg.Myinfo(), goipmsg.ANSENTRY)
	return nil
}