TCPNetworkStrategy

class TCPNetworkStrategy(host: Host, hostAddresses: Map<Host, InetSocketAddress>, connectionNumRetry: Int = CONNECTION_NUM_RETRY, connectionRetryDelay: Long = CONNECTION_RETRY_DELAY) : NetworkStrategy, Closeable

Implementation of a pairwise connected network using TCP sockets.

Constructors

Link copied to clipboard
fun TCPNetworkStrategy(host: Host, hostAddresses: Map<Host, InetSocketAddress>, connectionNumRetry: Int = CONNECTION_NUM_RETRY, connectionRetryDelay: Long = CONNECTION_RETRY_DELAY)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun <T> receive(type: KType, sender: Host): T

Receives a value of type type from sender.

Link copied to clipboard
open override fun <T> send(type: KType, value: T, receiver: Host)

Sends value of type type to receiver.

Link copied to clipboard
fun start()

Start runtime by opening sockets to other hosts.

Link copied to clipboard
open override fun url(host: Host): InetSocketAddress

Returns the network address of host.

Extensions

Link copied to clipboard
inline fun <T> NetworkStrategy.receive(sender: Host): T
Link copied to clipboard
inline fun <T> NetworkStrategy.send(value: T, receiver: Host)