No matching definitions.

tur/net

stdlib/net.tur

stub networking type (Socket) for linear resource tracking.

Since: Phase LT4

defstruct linear

Socket

(defstruct Socket :linear [fd :int])

a linear (exactly-once) wrapper around a POSIX socket fd.

Since: LT4

defn

socket-fd

(socket-fd [s : Socket] :int)

return the raw file descriptor from a Socket.

sa Socket value.

The underlying file descriptor (int).

(socket-fd my-socket)  ; => 5

Since: LT4

defn

socket-valid?

(socket-valid? [s : Socket] :bool)

return true if the Socket wraps a non-negative fd.

sa Socket value.

true if fd >= 0, false otherwise.

(socket-valid? my-socket)  ; => true

Since: LT4

defn

socket-close

(socket-close [s : Socket] :int)

close a Socket and release the underlying fd.

sa Socket to close (by value; handle is consumed).

0 on success, -1 on error.

(socket-close my-socket)  ; => 0

Since: LT4