server

fun server(port: Int = -1, tlsContext: TlsContext = PLAINTEXT_CONTEXT, inProcessServerName: String = "", bindAddress: String? = null, block: ServerBuilder<*>.() -> Unit): Server

Builds a gRPC Server using either a Netty transport or an in-process transport.

When inProcessServerName is non-empty, an in-process server is created (ignoring port, TLS and bind address). Otherwise a Netty server is created listening on port, at bindAddress or on every interface.

Return

the built Server

Parameters

port

the port to listen on (Netty transport only); 0 lets the OS choose one

tlsContext

the TLS configuration for the server; defaults to PLAINTEXT_CONTEXT

inProcessServerName

if non-empty, creates an in-process server with this name

bindAddress

the address to listen on, such as "127.0.0.1" (Netty transport only); null, the default, listens on every interface

block

a configuration block applied to the server builder before building

Throws

if the Netty transport is chosen and port is not in 0..65535