fs2.io.net.Network
See theNetwork companion object
sealed trait Network[F[_]] extends SocketGroup[F], DatagramSocketGroup[F]
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 tosendrequires theNetworkconstraint instead of requiring the much more powerfulAsyncconstraint. TheNetworkinstance has a set of global resources used for managing sockets. Alternatively, use thesocketGroupanddatagramSocketGroupoperations to manage the lifecycle of underlying resources. An instance ofNetworkis available for any effectFwhich has anAsync[F]instance. - Companion
- object
- Source
- Network.scala
- Graph
-
- Supertypes
Members list
In this article