Skip to content

Commit 8e69803

Browse files
committed
samples: net: echo_poll_test sample app
Simple app that just creates IPv4 and IPv6 TCP sockets, starts to listen them. If there is a incoming connection, it will launch a thread and pass the accepted socket to it. The thread will echo all data back that is sent to it. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
1 parent 61d42cf commit 8e69803

File tree

5 files changed

+408
-0
lines changed

5 files changed

+408
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.13.1)
4+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
project(socket_poll_echo)
6+
7+
FILE(GLOB app_sources src/*.c)
8+
target_sources(app PRIVATE ${app_sources})
9+
10+
include(${ZEPHYR_BASE}/samples/net/common/common.cmake)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This makefile builds sample for POSIX system, like Linux
2+
3+
socket_poll_echo: src/main.c
4+
$(CC) $^ -o $@ -lpthread
5+
6+
clean:
7+
rm -f socket_poll_echo
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. _sockets-poll-echo-sample:
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# General config
2+
CONFIG_NEWLIB_LIBC=y
3+
CONFIG_MAIN_STACK_SIZE=2048
4+
CONFIG_THREAD_NAME=y
5+
CONFIG_KERNEL_SHELL=y
6+
7+
# Networking config
8+
CONFIG_NETWORKING=y
9+
CONFIG_NET_IPV4=y
10+
CONFIG_NET_IPV6=y
11+
CONFIG_NET_TCP=y
12+
CONFIG_NET_SOCKETS=y
13+
CONFIG_NET_SOCKETS_POSIX_NAMES=y
14+
CONFIG_NET_SOCKETS_POLL_MAX=15
15+
16+
# Network driver config
17+
CONFIG_TEST_RANDOM_GENERATOR=y
18+
19+
# Network address config
20+
CONFIG_NET_CONFIG_SETTINGS=y
21+
CONFIG_NET_CONFIG_NEED_IPV4=y
22+
CONFIG_NET_CONFIG_NEED_IPV6=y
23+
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
24+
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
25+
CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
26+
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
27+
28+
CONFIG_NET_SHELL=y

0 commit comments

Comments
 (0)