예제 #1
0
파일: host.go 프로젝트: deft-code/go-enet
// enet_host_service
func (host *Host) Service(timeout time.Duration) (*Event, error) {
	if timeout < 0 {
		return nil, errors.New("Timeout duration was negative")
	}

	var c_event C.ENetEvent

	ret := C.enet_host_service(host.host, &c_event, C.enet_uint32(timeout/time.Millisecond))

	return host.ret_to_error(&c_event, ret)
}
예제 #2
0
파일: host.go 프로젝트: boj/goenet
func (h *ENetHost) Service(event *ENetEvent, timeout int) int {
	return int(C.enet_host_service((*C.ENetHost)(h), (*C.ENetEvent)(event), C.enet_uint32(timeout)))
}