Liking cljdoc? Tell your friends :D

easy-nio.channel

Wrapper around java.nio.channels for non-blocking network I/O.

Channels are stateful. Functions that mutate channel state use the ! suffix convention.

Wrapper around java.nio.channels for non-blocking network I/O.

Channels are stateful. Functions that mutate channel state use the !
suffix convention.
raw docstring

accept!clj

(accept! ch)

Accepts an incoming connection on ch.

In blocking mode: blocks until a connection arrives and returns the new SocketChannel.

In non-blocking mode: returns the new SocketChannel immediately, or nil if no connection is pending.

Accepts an incoming connection on `ch`.

In blocking mode: blocks until a connection arrives and returns the
new SocketChannel.

In non-blocking mode: returns the new SocketChannel immediately, or
nil if no connection is pending.
sourceraw docstring

bind!clj

(bind! ch addr)
(bind! ch addr backlog)

Binds ch to addr (an InetSocketAddress).

For ServerSocketChannel, accepts an optional backlog — the maximum number of pending connections. Defaults to 0 (system default).

Binds `ch` to `addr` (an InetSocketAddress).

For ServerSocketChannel, accepts an optional `backlog` — the maximum
number of pending connections. Defaults to 0 (system default).
sourceraw docstring

blocking?clj

(blocking? ch)

Returns true if ch is in blocking mode.

Returns true if `ch` is in blocking mode.
sourceraw docstring

configure-blocking!clj

(configure-blocking! ch blocking)

Sets the blocking mode of ch. Pass false for non-blocking I/O. Returns ch.

Sets the blocking mode of `ch`. Pass false for non-blocking I/O.
Returns `ch`.
sourceraw docstring

connect!clj

(connect! ch addr)

Connects ch to addr (an InetSocketAddress).

In blocking mode: blocks until the connection is established and returns true.

In non-blocking mode: initiates the connection and returns false if it cannot be completed immediately. Call finish-connect! later to complete it (typically after a Selector signals OP_CONNECT).

Connects `ch` to `addr` (an InetSocketAddress).

In blocking mode: blocks until the connection is established and
returns true.

In non-blocking mode: initiates the connection and returns false if
it cannot be completed immediately. Call finish-connect! later to
complete it (typically after a Selector signals OP_CONNECT).
sourceraw docstring

connected?clj

(connected? ch)

Returns true if ch has an established connection.

Returns true if `ch` has an established connection.
sourceraw docstring

connection-pending?clj

(connection-pending? ch)

Returns true if a non-blocking connect! has been initiated on ch but not yet completed via finish-connect!.

Returns true if a non-blocking connect! has been initiated on `ch`
but not yet completed via finish-connect!.
sourceraw docstring

datagram-bind!clj

(datagram-bind! ch addr)

Binds ch (a DatagramChannel) to addr (an InetSocketAddress). Pass (inet-address port) with no host to bind to the wildcard address.

Binds `ch` (a DatagramChannel) to `addr` (an InetSocketAddress).
Pass (inet-address port) with no host to bind to the wildcard address.
sourceraw docstring

datagram-channelclj

(datagram-channel)

Opens and returns a new DatagramChannel in blocking mode.

Opens and returns a new DatagramChannel in blocking mode.
sourceraw docstring

datagram-connect!clj

(datagram-connect! ch addr)

Connects ch (a DatagramChannel) to addr. This is optional and restricts the channel to only send/receive datagrams from that address. Not required for general UDP usage.

Connects `ch` (a DatagramChannel) to `addr`.
This is optional and restricts the channel to only send/receive
datagrams from that address. Not required for general UDP usage.
sourceraw docstring

datagram-connected?clj

(datagram-connected? ch)

Returns true if ch (a DatagramChannel) is connected to a specific remote address.

Returns true if `ch` (a DatagramChannel) is connected to a specific
remote address.
sourceraw docstring

disconnect!clj

(disconnect! ch)

Disconnects ch (a DatagramChannel) from its connected address, if any. Safe to call on an unconnected channel. Returns ch.

Disconnects `ch` (a DatagramChannel) from its connected address,
if any. Safe to call on an unconnected channel. Returns `ch`.
sourceraw docstring

finish-connect!clj

(finish-connect! ch)

Completes a non-blocking connection initiated by connect!. Returns true if the connection is now established, false if it is still in progress.

Completes a non-blocking connection initiated by connect!.
Returns true if the connection is now established, false if it is
still in progress.
sourceraw docstring

get-optionclj

(get-option ch option)

Gets the current value of a socket option on ch.

Gets the current value of a socket option on `ch`.
sourceraw docstring

inet-addressclj

(inet-address port)
(inet-address host port)

Constructs an InetSocketAddress from host (String) and port (int). With arity-1, constructs a wildcard address bound to port.

Constructs an InetSocketAddress from `host` (String) and `port` (int).
With arity-1, constructs a wildcard address bound to `port`.
sourceraw docstring

local-addressclj

(local-address ch)

Returns the local SocketAddress bound to ch, or nil if unbound.

Returns the local SocketAddress bound to `ch`, or nil if unbound.
sourceraw docstring

remote-addressclj

(remote-address ch)

Returns the remote SocketAddress connected to ch, or nil if the channel is not connected.

Returns the remote SocketAddress connected to `ch`, or nil if
the channel is not connected.
sourceraw docstring

server-socket-channelclj

(server-socket-channel)

Opens and returns a new ServerSocketChannel in blocking mode.

Opens and returns a new ServerSocketChannel in blocking mode.
sourceraw docstring

set-option!clj

(set-option! ch option value)

Sets a socket option on ch. option should be a constant from java.net.StandardSocketOptions e.g. StandardSocketOptions/TCP_NODELAY. Returns ch.

Sets a socket option on `ch`. `option` should be a constant from
java.net.StandardSocketOptions e.g. StandardSocketOptions/TCP_NODELAY.
Returns `ch`.
sourceraw docstring

shutdown-input!clj

(shutdown-input! ch)

Shuts down the read half of ch without closing the channel. Subsequent reads will return -1 (EOF). The write half remains open. Returns ch. Throws NotYetConnectedException if the channel is not connected.

Shuts down the read half of `ch` without closing the channel.
Subsequent reads will return -1 (EOF). The write half remains open.
Returns `ch`.
Throws NotYetConnectedException if the channel is not connected.
sourceraw docstring

shutdown-output!clj

(shutdown-output! ch)

Shuts down the write half of ch without closing the channel. Subsequent writes will throw ClosedChannelException. The read half remains open, allowing any in-flight data from the remote end to still be received. Returns ch. Throws NotYetConnectedException if the channel is not connected.

Shuts down the write half of `ch` without closing the channel.
Subsequent writes will throw ClosedChannelException. The read half
remains open, allowing any in-flight data from the remote end to
still be received. Returns `ch`.
Throws NotYetConnectedException if the channel is not connected.
sourceraw docstring

socket-channelclj

(socket-channel)
(socket-channel addr)

Opens and returns a new SocketChannel in blocking mode. With arity-1, opens and immediately connects to addr.

Opens and returns a new SocketChannel in blocking mode.
With arity-1, opens and immediately connects to `addr`.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close