I'm sending bytes as array of bytestrings through akka Source and Tcp, length of full array which includes: begin ++ len ++ gzip ++ sign ++ term
is 997, but only 710 bytes reach the server. The code is here:
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Source, Tcp}
import akka.util.ByteString
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
class UpperServiceClient(ip: String, port: Int){
def run = {
implicit val system = ActorSystem("ClientSys")
implicit val materializer = ActorMaterializer()
...
// Initializing of (begin, len, gzip, sign, term) arrays
...
val conn = Tcp().outgoingConnection(ip, port)
val res: Future[ByteString] = Source(begin ++ len ++ gzip ++ sign ++ term).via(conn).
runFold(ByteString.empty) { (acc, in) => acc ++ in }
val resp = Await.result(res, 3.seconds)
}
}
The server accepts and successfully processes first 710 bytes. There are no problems on server, cause when I'm trying send those bytes from another client the message comes complete. Any ideas with what the problem can be connected? Or may be somebody can advise how to split the message into two and send it through one connection?