I am trying to understand why I'm seeing TCP retransmissions on a simple
program. I created a small program based on the 2.4.2 docs:
object HelloWorld {
def main(args: Array[String]): Unit = {
implicit val system = ActorSystem("Sys")
implicit val materializer = ActorMaterializer()
val connections: Source[IncomingConnection, Future[Tcp.ServerBinding]] =
Tcp().bind("localhost", 8888)
connections runForeach { connection =>
// server logic, parses incoming commands
val commandParser = Flow[String].takeWhile(_ != "BYE").map(_ + "!")
import connection._
val welcomeMsg = s"Welcome to: $localAddress, you are: $remoteAddress!"
val welcome = Source.single(welcomeMsg)
val serverLogic = Flow[ByteString]
.via(Framing.delimiter( ByteString("\n"), 256 ))
.map(_.utf8String)
.via(commandParser)
// merge in the initial banner after parser
.merge(welcome)
.map(_ + "\n")
.map(ByteString(_))
connection.handleWith(serverLogic)
}
}
}
But when I connect to localhost/8888 via telnet, type in a few lines, and
watch the traffic with wireshark, I'm seeing various retransmits and out of
order:
46482→8888 [SYN] Seq=0 Win=43690 Len=0 MSS=65495 SACK_PERM=1 TSval=47383693
TSecr=0 WS=128
8888→46482 [SYN, ACK] Seq=0 Ack=1 Win=43690 Len=0 MSS=65495 SACK_PERM=1
TSval=47383693 TSecr=47383693 WS=128
46482→8888 [ACK] Seq=1 Ack=1 Win=43776 Len=0 TSval=47383693 TSecr=47383693
8888→46482 [PSH, ACK] Seq=1 Ack=1 Win=43776 Len=56 TSval=47383719
TSecr=47383693
46482→8888 [ACK] Seq=1 Ack=57 Win=43776 Len=0 TSval=47383719 TSecr=47383719
[TCP Out-Of-Order] 46482→8888 [SYN] Seq=0 Win=43690 Len=0 MSS=65495
SACK_PERM=1 TSval=47383693 TSecr=0 WS=128
[TCP Retransmission] 8888→46482 [SYN, ACK] Seq=0 Ack=1 Win=43690 Len=0
MSS=65495 SACK_PERM=1 TSval=47383693 TSecr=47383693 WS=128
46482→8888 [ACK] Seq=1 Ack=1 Win=43776 Len=0 TSval=47383693 TSecr=47383693
[TCP Retransmission] 8888→46482 [PSH, ACK] Seq=1 Ack=1 Win=43776 Len=56
TSval=47383719 TSecr=47383693
46482→8888 [ACK] Seq=1 Ack=57 Win=43776 Len=0 TSval=47383719 TSecr=47383719
46482→8888 [PSH, ACK] Seq=1 Ack=57 Win=43776 Len=6 TSval=47384746
TSecr=47383719
8888→46482 [ACK] Seq=57 Ack=7 Win=43776 Len=0 TSval=47384746 TSecr=47384746
8888→46482 [PSH, ACK] Seq=57 Ack=7 Win=43776 Len=7 TSval=47384747
TSecr=47384746
46482→8888 [ACK] Seq=7 Ack=64 Win=43776 Len=0 TSval=47384747 TSecr=47384747
[TCP Retransmission] 46482→8888 [PSH, ACK] Seq=1 Ack=57 Win=43776 Len=6
TSval=47384746 TSecr=47383719
8888→46482 [ACK] Seq=57 Ack=7 Win=43776 Len=0 TSval=47384746 TSecr=47384746
[TCP Retransmission] 8888→46482 [PSH, ACK] Seq=57 Ack=7 Win=43776 Len=7
TSval=47384747 TSecr=47384746
46482→8888 [ACK] Seq=7 Ack=64 Win=43776 Len=0 TSval=47384747 TSecr=47384747
46482→8888 [PSH, ACK] Seq=7 Ack=64 Win=43776 Len=6 TSval=47386128
TSecr=47384747
8888→46482 [PSH, ACK] Seq=64 Ack=13 Win=43776 Len=7 TSval=47386129
TSecr=47386128
46482→8888 [ACK] Seq=13 Ack=71 Win=43776 Len=0 TSval=47386129 TSecr=47386129
[TCP Retransmission] 46482→8888 [PSH, ACK] Seq=7 Ack=64 Win=43776 Len=6
TSval=47386128 TSecr=47384747
[TCP Retransmission] 8888→46482 [PSH, ACK] Seq=64 Ack=13 Win=43776 Len=7
TSval=47386129 TSecr=47386128
46482→8888 [ACK] Seq=13 Ack=71 Win=43776 Len=0 TSval=47386129 TSecr=47386129
Full trace at http://pastebin.com/09xi1kGa
Could someone explain to me if I'm doing something wrong, or what's going
on?
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.