fs2.io.net.Network
See theNetwork companion object
Provides the ability to work with TCP, UDP, and TLS.
Attributes
- Example:
import fs2.Stream import fs2.io.net.{Datagram, Network} def send[F[_]: Network](datagram: Datagram): F[Unit] = Network[F].openDatagramSocket().use { socket => socket.write(packet) }
In this example, the
F[_]
parameter tosend
requires theNetwork
constraint instead of requiring the much more powerfulAsync
constraint. TheNetwork
instance has a set of global resources used for managing sockets. Alternatively, use thesocketGroup
anddatagramSocketGroup
operations to manage the lifecycle of underlying resources. An instance ofNetwork
is available for any effectF
which has anAsync[F]
instance.- Companion:
- object
- Source:
- Network.scala
- Graph
- Supertypes