FIXME: This should not be Socket-specific
FIXME: This is Unix-specific
socket :: NativeSocketSet :: defaultinit
socket :: NativeSocketSet :: new
socket $ NativeSocketSet :: SELF
Type of this instance, automatically specialized in every classcore :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
socket :: NativeSocketSet :: defaultinit
core :: Object :: defaultinit
core :: Pointer :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
socket :: NativeSocketSet :: new
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Structure used to register FDs for a Select
#
# FIXME: This should not be Socket-specific
# FIXME: This is Unix-specific
extern class NativeSocketSet `{ fd_set* `}
new `{
fd_set *f = NULL;
f = malloc(sizeof(fd_set));
return f;
`}
# Add a file descriptor to the set
fun set(s: NativeSocket) `{ FD_SET(*s, self); `}
# Check if `s` is in the set
fun is_set(s: NativeSocket): Bool `{ return FD_ISSET(*s, self); `}
# Clear the set
fun zero `{ FD_ZERO(self); `}
# Remove `s` from the set
fun clear(s: NativeSocket) `{ FD_CLR(*s, self); `}
# Free the set
fun destroy `{ free(self); `}
end
lib/socket/socket_c.nit:369,1--394,3