// enet_peer_send func (peer *Peer) Send(channelID uint8, data []byte, flags Flag) error { c_packet := new_packet(data, flags) defer C.enet_packet_destroy(c_packet) ret := C.enet_peer_send(peer.peer, C.enet_uint8(channelID), c_packet) if ret < 0 { return errors.New("ENet failed to send packet") } return nil }
func (p *Peer) sendOutgoingPackets() { for { outPacket := <-p.out C.enet_peer_send(p.cPeer, C.enet_uint8(outPacket.channel), outPacket.packet) } }
// enet_host_broadcast func (host *Host) Broadcast(channelID uint8, packet []byte, flags Flag) { C.enet_host_broadcast(host.host, C.enet_uint8(channelID), new_packet(packet, flags)) }
func (p *ENetPeer) Send(channelID int, packet *ENetPacket) int { return int(C.enet_peer_send((*C.ENetPeer)(p), C.enet_uint8(channelID), (*C.ENetPacket)(packet))) }
func (h *ENetHost) Broadcast(channelID int, packet *ENetPacket) { C.enet_host_broadcast((*C.ENetHost)(h), C.enet_uint8(channelID), (*C.ENetPacket)(packet)) }