abla/net/hosted

Generated from source.

Import with import "abla/net/hosted".

Source: abla/net/hosted/entry.ab

HostedSocketReadResult (class)

class HostedSocketReadResult(
    val bytes: string,
    val status: string,
    val errorCode: int
)

Holds bytes, read status and the host error code from one socket read.

HostedSocketReadResult.hasData (method)

fun hasData(): bool

Returns whether the read produced data.

HostedSocketReadResult.reachedEof (method)

fun reachedEof(): bool

Returns whether the peer reached end of stream.

HostedSocketReadResult.wouldBlock (method)

fun wouldBlock(): bool

Returns whether a nonblocking read needs more time to become ready.

HostedSocketReadResult.failed (method)

fun failed(): bool

Returns whether the read ended with a socket error.

HostedSocketReadResult.networkOutcome (extension fun)

fun HostedSocketReadResult.networkOutcome(
    operation: string = "read"
): NetworkReadOutcome

Converts the host read result to a portable network outcome tagged with the operation name.

HostedSocketWriteResult (class)

class HostedSocketWriteResult(
    val written: int,
    val wouldBlock: bool,
    val errorCode: int
)

Holds the write count, would-block indication and host error code from one socket write.

HostedSocketWriteResult.succeeded (method)

fun succeeded(): bool

Returns whether the write reported a nonnegative byte count.

HostedSocketWriteResult.failed (method)

fun failed(): bool

Returns whether the write failed with an error other than would-block.

HostedSocketWriteResult.networkOutcome (extension fun)

fun HostedSocketWriteResult.networkOutcome(
    operation: string = "write"
): NetworkWriteOutcome

Converts the host write result to a portable network outcome tagged with the operation name.

HostedSocketEvent (class)

class HostedSocketEvent(
    val descriptor: int,
    val readable: bool,
    val writable: bool,
    val closed: bool,
    val error: bool
)

Reports read, write, closure and error readiness for one socket descriptor.

HostedSocketEvents (class)

class HostedSocketEvents(
    val events: array<HostedSocketEvent>,
    val timedOut: bool,
    val errorCode: int
)

Holds the ready events from one poll call, with its timeout and host error status.

HostedSocketEvents.failed (method)

fun failed(): bool

Returns whether the poll call recorded a nonzero host error code.

HostedUdpDatagram (class)

class HostedUdpDatagram(
    val bytes: string,
    val sourceAddress: string,
    val sourcePort: int,
    val received: bool,
    val wouldBlock: bool,
    val errorCode: int
)

Holds the received datagram and sender address or the receive error and would-block state.

HostedTcpListener (class)

resource class HostedTcpListener(var descriptor: int)

Owns a listening TCP socket and uses a negative descriptor for an unavailable socket.

HostedTcpListener.drop (method)

fun drop(): void

Closes the held descriptor when the resource is dropped.

HostedTcpConnection (class)

resource class HostedTcpConnection(var descriptor: int)

Owns a TCP connection and uses a negative descriptor for an unavailable socket.

HostedTcpConnection.drop (method)

fun drop(): void

Closes the held descriptor when the resource is dropped.

HostedUdpSocket (class)

resource class HostedUdpSocket(var descriptor: int)

Owns a UDP socket and uses a negative descriptor for an unavailable socket.

HostedUdpSocket.drop (method)

fun drop(): void

Closes the held descriptor when the resource is dropped.

HostedSocketPoller (class)

resource class HostedSocketPoller(var descriptor: int)

Owns a host socket poller and uses a negative descriptor if it is unavailable.

HostedSocketPoller.drop (method)

fun drop(): void

Closes the held descriptor when the resource is dropped.

hostedTcpConnect (fun)

fun hostedTcpConnect(
    host: string,
    port: int,
    timeoutMilliseconds: int = 5000
): HostedTcpConnection

Returns a connected TCP socket, or a negative descriptor if connecting fails or times out.

hostedTcpListen (fun)

fun hostedTcpListen(
    host: string = "::",
    port: int = 0,
    backlog: int = 128,
    dualStack: bool = true
): HostedTcpListener

Returns a TCP listener at the requested address and port, or a negative descriptor if opening it fails.

HostedTcpListener.accept (extension fun)

fun HostedTcpListener.accept(): HostedTcpConnection

Returns an accepted TCP connection or a negative descriptor if none could be accepted.

HostedTcpListener.localPort (extension fun)

fun HostedTcpListener.localPort(): int

Returns the bound port or -1 if the host cannot report it.

HostedTcpListener.setNonblocking (extension fun)

fun HostedTcpListener.setNonblocking(enabled: bool = true): bool

Changes whether accepts may block and returns whether the host applied the setting.

HostedTcpConnection.setNonblocking (extension fun)

fun HostedTcpConnection.setNonblocking(enabled: bool = true): bool

Changes whether reads and writes may block and returns whether the host applied the setting.

HostedTcpConnection.readResult (extension fun)

fun HostedTcpConnection.readResult(
    maximum: int = 65536
): HostedSocketReadResult

Reads up to the requested bytes and reports data, EOF, would-block or an error.

HostedTcpConnection.readNetwork (extension fun)

fun HostedTcpConnection.readNetwork(
    maximum: int,
    timeoutMilliseconds: int,
    cancellation: NetworkCancellation = networkCancellation(),
    cancellationPollMilliseconds: int = 50
): NetworkReadOutcome

Waits for a readable socket and returns data, EOF, cancellation, timeout or an error.

HostedTcpConnection.writeResult (extension fun)

fun HostedTcpConnection.writeResult(
    contents: string
): HostedSocketWriteResult

Attempts one write and returns the supplied byte count accepted so far or a host error.

HostedTcpConnection.writeNetwork (extension fun)

fun HostedTcpConnection.writeNetwork(
    contents: string,
    timeoutMilliseconds: int,
    cancellation: NetworkCancellation = networkCancellation(),
    cancellationPollMilliseconds: int = 50
): NetworkWriteOutcome

Writes until complete, canceled, timed out or failed and returns the outcome with its byte count.

HostedTcpConnection.close (extension fun)

fun HostedTcpConnection.close(): bool

Returns true if the descriptor closes successfully or is already closed.

HostedTcpListener.close (extension fun)

fun HostedTcpListener.close(): bool

Returns true if the descriptor closes successfully or is already closed.

hostedUdpBind (fun)

fun hostedUdpBind(
    host: string = "::",
    port: int = 0,
    dualStack: bool = true
): HostedUdpSocket

Returns a UDP socket bound to the requested address and port or a negative descriptor if binding fails.

HostedUdpSocket.localPort (extension fun)

fun HostedUdpSocket.localPort(): int

Returns the bound port or -1 if the host cannot report it.

HostedUdpSocket.setNonblocking (extension fun)

fun HostedUdpSocket.setNonblocking(enabled: bool = true): bool

Changes whether socket operations may block and returns whether the host applied the setting.

HostedUdpSocket.sendTo (extension fun)

fun HostedUdpSocket.sendTo(
    contents: string,
    host: string,
    port: int
): int

Sends one datagram and returns its byte count or the negated host error code.

HostedUdpSocket.receiveFrom (extension fun)

fun HostedUdpSocket.receiveFrom(
    maximum: int = 65535
): HostedUdpDatagram

Receives up to the requested datagram bytes and reports the sender or the receive failure.

HostedUdpSocket.close (extension fun)

fun HostedUdpSocket.close(): bool

Returns true if the descriptor closes successfully or is already closed.

hostedSocketPoller (fun)

trusted fun hostedSocketPoller(): HostedSocketPoller

Returns a new socket poller or a negative descriptor if creating it fails.

HostedSocketPoller.watchDescriptor (extension fun)

fun HostedSocketPoller.watchDescriptor(
    descriptor: int,
    read: bool = true,
    write: bool = false
): bool

Registers read or write interest for a descriptor and returns whether the host accepted it.

HostedSocketPoller.modifyDescriptor (extension fun)

fun HostedSocketPoller.modifyDescriptor(
    descriptor: int,
    read: bool = true,
    write: bool = false
): bool

Updates an existing descriptor's read or write interest and returns whether the host accepted it.

HostedSocketPoller.unwatchDescriptor (extension fun)

fun HostedSocketPoller.unwatchDescriptor(descriptor: int): bool

Removes a descriptor from the poller and returns whether the host removed it.

HostedSocketPoller.wait (extension fun)

fun HostedSocketPoller.wait(
    maximumEvents: int = 64,
    timeoutMilliseconds: int = 5000
): HostedSocketEvents

Waits for readiness and returns up to the requested number of events, with timeout or host error status.

HostedSocketPoller.close (extension fun)

fun HostedSocketPoller.close(): bool

Returns true if the descriptor closes successfully or is already closed.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.