Packages

  • package root
    Definition Classes
    root
  • package fs2
    Definition Classes
    root
  • package io

    Provides various ways to work with streams that perform IO.

    Provides various ways to work with streams that perform IO.

    Definition Classes
    fs2
  • package file

    Provides support for working with files.

    Provides support for working with files.

    Definition Classes
    io
  • package tcp

    Provides support for TCP networking.

    Provides support for TCP networking.

    Definition Classes
    io
  • package tls
    Definition Classes
    io
  • package udp

    Provides support for UDP networking.

    Provides support for UDP networking.

    Definition Classes
    io
  • Network
  • Watcher

sealed trait Network[F[_]] extends AnyRef

Provides the ability to work with TCP, UDP, and TLS.

Source
Network.scala
Example:
  1. import fs2.Stream
    import fs2.io.{Network, udp}
    
    def send[F[_]: Network](packet: udp.Packet): F[Unit] =
      Network[F].udpSocketGroup.open().use { socket =>
        socket.write(packet)
      }

    In this example, the F[_] parameter to send requires the Network constraint instead of requiring the much more powerful Async. An instance of Network is available for any effect F which has an Async[F] instance.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Network
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def tcpSocketGroup: Resource[F, SocketGroup[F]]

    Returns a TCP SocketGroup as a resource.

    Returns a TCP SocketGroup as a resource.

    The SocketGroup supports both server and client sockets. When the resource is used, a fixed thread pool is created and used to initialize a java.nio.channels.AsynchronousChannelGroup. All network reads/writes occur on this fixed thread pool. The pool size is set to the number of processors returned by Runtime.getRuntime.availableProcessors. To customize this, use tcpSocketGroupWithConfig.

    When the socket group is finalized, the fixed thread pool is terminated and any future reads/writes on sockets created by the socket group will fail.

  2. abstract def tcpSocketGroupWithConfig(nonBlockingThreadCount: Int = 0, nonBlockingThreadFactory: ThreadFactory = ...): Resource[F, SocketGroup[F]]

    Like tcpSocketGroup but allows configuration of the fixed size thread pool used for NIO.

  3. abstract def tlsContext: Builder[F]

    Returns a builder for TLSContext[F] values.

    Returns a builder for TLSContext[F] values.

    For example, Network[IO].tlsContext.system returns a F[TLSContext[F]].

  4. abstract def udpSocketGroup: Resource[F, SocketGroup[F]]

    Returns a UDP SocketGroup as a resource.

    Returns a UDP SocketGroup as a resource.

    The SocketGroup supports both receiving and sending UDP datagrams. When the resource is acquired, a dedicated thread is started, which performs all non-blocking network calls. When the resource is finalized, the thread is terminated and any sockets opened from the socket group are closed.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  15. def toString(): String
    Definition Classes
    AnyRef → Any
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped