Skip to content
Browse files

samples: net: echo_server: Enable SO_TIMESTAMPING if needed

If user has set CONFIG_NET_CONTEXT_TIMESTAMP then enable
network packet throughput collection for UDP packets.

Signed-off-by: Jukka Rissanen <>
  • Loading branch information...
jukkar committed May 30, 2019
1 parent 4bb57c4 commit 530a1e5415b1ee1d6a145134c8ca9ae8af27f537
Showing with 6 additions and 0 deletions.
  1. +6 −0 samples/net/sockets/echo_server/src/udp.c
@@ -72,6 +72,12 @@ static int start_udp_proto(struct data *data, struct sockaddr *bind_addr,

bool val = 1;

setsockopt(data->udp.sock, SOL_SOCKET, SO_TIMESTAMPING, &val, sizeof(val));

ret = bind(data->udp.sock, bind_addr, bind_addrlen);
if (ret < 0) {
NET_ERR("Failed to bind UDP socket (%s): %d", data->proto,

0 comments on commit 530a1e5

Please sign in to comment.
You can’t perform that action at this time.