Working with streaming I/O
One of the most common scenarios of streaming is input-output applications. Nowadays, almost any modern application uses I/O to communicate with external entities or services. This is usually achieved by either listening on a port or pushing data to a remote system. For example, this concept is what the Internet of Things relies on when machines use I/O to contact with each other.
Akka Streams provide a set of Sources and Sinks to use files, InputStreams, and OutputStreams in your streams. In this recipe, we will create a stream to listen for words and count them as they come.
Getting ready
In this recipe, we will create a stream that will listen for TCP connections on port 1234
. Once it receives an incoming message from the stream, it will count its words and return the counts in ByteString
.
How to do it...
For this recipe, perform the following steps:
- Create a file named
WorkingIOStreamsApplication.scala
inside thecom.packt.chapter8
 package.  This object instantiates...