SocketGroup

final class SocketGroup(channelGroup: AsynchronousChannelGroup, blocker: Blocker)

Resource that provides the ability to open client and server TCP sockets that all share an underlying non-blocking channel group.

Resource that provides the ability to open client and server TCP sockets that all share an underlying non-blocking channel group.

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def client[F[_]](to: InetSocketAddress, reuseAddress: Boolean, sendBufferSize: Int, receiveBufferSize: Int, keepAlive: Boolean, noDelay: Boolean, additionalSocketOptions: List[SocketOptionMapping[_]])(F: Concurrent[F], CS: ContextShift[F]): Resource[F, Socket[F]]

Opens a connection to the specified server represented as a Socket. The connection is closed when the resource is released.

Opens a connection to the specified server represented as a Socket. The connection is closed when the resource is released.

Value Params
keepAlive

whether keep-alive on tcp is used (see java.net.StandardSocketOptions.SO_KEEPALIVE)

noDelay

whether tcp no-delay flag is set (see java.net.StandardSocketOptions.TCP_NODELAY)

receiveBufferSize

size of receive buffer (see java.net.StandardSocketOptions.SO_RCVBUF)

reuseAddress

whether address may be reused (see java.net.StandardSocketOptions.SO_REUSEADDR)

sendBufferSize

size of send buffer (see java.net.StandardSocketOptions.SO_SNDBUF)

to

address of remote server

def server[F[_]](address: InetSocketAddress, maxQueued: Int, reuseAddress: Boolean, receiveBufferSize: Int, additionalSocketOptions: List[SocketOptionMapping[_]])(F: Concurrent[F], CS: ContextShift[F]): Stream[F, Resource[F, Socket[F]]]

Stream that binds to the specified address and provides a connection for, represented as a Socket, for each client that connects to the bound address.

Stream that binds to the specified address and provides a connection for, represented as a Socket, for each client that connects to the bound address.

Returns a stream of stream of sockets.

The outer stream scopes the lifetime of the server socket. When the outer stream terminates, all open connections will terminate as well. The outer stream emits an element (an inner stream) for each client connection.

Each inner stream represents an individual connection, and as such, is a stream that emits a single socket. Failures that occur in an inner stream do NOT cause the outer stream to fail.

Value Params
address

address to accept connections from

maxQueued

number of queued requests before they will become rejected by server (supply <= 0 for unbounded)

receiveBufferSize

size of receive buffer (see java.net.StandardSocketOptions.SO_RCVBUF)

reuseAddress

whether address may be reused (see java.net.StandardSocketOptions.SO_REUSEADDR)

def serverResource[F[_]](address: InetSocketAddress, reuseAddress: Boolean, receiveBufferSize: Int, additionalSocketOptions: List[SocketOptionMapping[_]])(F: Concurrent[F], CS: ContextShift[F]): Resource[F, (InetSocketAddress, Stream[F, Resource[F, Socket[F]]])]

Like server but provides the InetSocketAddress of the bound server socket before providing accepted sockets. The inner stream emits one socket for each client that connects to the server.

Like server but provides the InetSocketAddress of the bound server socket before providing accepted sockets. The inner stream emits one socket for each client that connects to the server.

Deprecated methods

@deprecated("Use serverResource instead", "2.2.0")
def serverWithLocalAddress[F[_]](address: InetSocketAddress, maxQueued: Int, reuseAddress: Boolean, receiveBufferSize: Int, additionalSocketOptions: List[SocketOptionMapping[_]])(F: Concurrent[F], CS: ContextShift[F]): Stream[F, Either[InetSocketAddress, Resource[F, Socket[F]]]]
Deprecated