Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1362

Set type of service field in IP headers

$
0
0

Hi all,
I would to know if there is a way to set the value of the differentiated service field in the IP header of the packets sent during an http request.
In the documentation I saw that something like that can be set via the TrafficClass, and since this class extends the trait SocketOption, I tried to pass this option to the client connection settings.
Following there is a little example code, where I tried to set the traffic class value for example to 50:

object SingleRequest {
  def main(args: Array[String]): Unit = {
    implicit val system = ActorSystem()

    val settings: ClientConnectionSettings = ClientConnectionSettings(system).withSocketOptions(Seq(TcpSO.trafficClass(50)))

    val poolSettings: ConnectionPoolSettings =
      ConnectionPoolSettings(system)
        .withConnectionSettings(settings)

    val http: HttpExt = Http(system)
    val response = http.singleRequest(HttpRequest(uri = "http://localhost:5016"),settings = poolSettings)

  }
}

But analyzing the packets arrived to localhost it seems the differentiated service field in each of them is always 0.

Can anyone help me to set this value correctly?
Thank you

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1362