Example #1
0
func conv_addr(address *net.UDPAddr) (c_addr C.ENetAddress) {
	c_ip := C.CString(address.IP.String())
	defer C.free(unsafe.Pointer(c_ip))

	C.enet_address_set_host(&c_addr, c_ip)
	c_addr.port = C.enet_uint16(address.Port)
	return
}
Example #2
0
func (a *ENetAddress) SetHostName(hostName string) int {
	hName := C.CString(hostName)
	defer C.free(unsafe.Pointer(hName))
	return int(C.enet_address_set_host((*C.ENetAddress)(a), hName))
}