fs2.io.net
package fs2.io.net
Type members
Classlikes
A single datagram to send to the specified remote address or received from the specified address.
- Value Params
- bytes
-
data to send/receive
- remote
-
remote party to send/receive datagram to/from
Provides the ability to work with TCP, UDP, and TLS.
- 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, theF[_]
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
Supports creation of client and server TCP sockets that all share
an underlying non-blocking channel group.
an underlying non-blocking channel group.
sealed trait SocketOption
Specifies a socket option on a TCP/UDP socket.
The companion provides methods for creating a socket option from each of the
JDK java.net.StandardSocketOptions as well as the ability to construct arbitrary
additional options. See the docs on
JDK java.net.StandardSocketOptions as well as the ability to construct arbitrary
additional options. See the docs on
StandardSocketOptions
for details on each.- Companion
- object