Пример #1
0
// enet_host_connect
func (host *Host) Connect(address *net.UDPAddr, channelCount uint, data uint) (*Peer, error) {
	c_addr := conv_addr(address)
	c_peer := C.enet_host_connect(host.host, &c_addr, C.size_t(channelCount), C.enet_uint32(data))

	if c_peer == nil {
		return nil, errors.New("No available peers for initiating an ENet connection.")
	}

	peer := &Peer{c_peer}
	host.peers[c_peer] = peer

	return peer, nil
}
Пример #2
0
Файл: host.go Проект: boj/goenet
func (h *ENetHost) Connect(a *ENetAddress, channelCount int, data int) *ENetPeer {
	return (*ENetPeer)(C.enet_host_connect((*C.ENetHost)(h), (*C.ENetAddress)(a), C.size_t(channelCount), C.enet_uint32(data)))
}