Example #1
0
func (sa *SockaddrIn6) Name() (name string, err error) {
	b := make([]byte, 256)
	r := C.uv_ip6_name(&sa.sa, (*C.char)(unsafe.Pointer(&b[0])), C.size_t(len(b)))
	if r != 0 {
		e := C.uv_last_error(C.uv_default_loop())
		return "", errors.New(C.GoString(C.uv_strerror(e)))
	}
	return string(b), nil
}
Example #2
0
File: addr.go Project: zchee/gouv
func (sa *SockaddrIn6) Name() (name string, err error) {
	b := make([]byte, 256)
	r := C.uv_ip6_name(&sa.sa, (*C.char)(unsafe.Pointer(&b[0])), C.size_t(len(b)))
	if r != 0 {
		var error C.uv_err_t
		error.code = C.uv_err_code(r)
		return "", errors.New(C.GoString(C.uv_strerror(error)))
	}
	return string(b), nil
}
Example #3
0
func (err *Error) String() string {
	return C.GoString(C.uv_strerror(err.e))
}
Example #4
0
func (err UvError) Error() string {
	message := C.GoString(C.uv_strerror(C.int(err.Code)))
	return fmt.Sprintf("uv_error: %s (%d)", message, err.Code)
}
Example #5
0
File: error.go Project: zchee/gouv
func (err *Error) String() string {
	var error C.uv_err_t
	error.code = C.uv_err_code(err.e)
	return C.GoString(C.uv_strerror(error))
}