Add timeout send/recv and multicast client/server socket examples (#1519)

Add a couple of socket examples that can be used with WAMR:
- The `timeout_client` and `timeout_server` examples demonstrate socket
  send and receive timeouts using the socket options
- The `multicast_client` and `multicast_server` examples demonstrate receiving
  multicast packets in WASM

And add several macro controls for `socket_opts` example.
This commit is contained in:
Callum Macmillan
2022-10-07 03:31:21 +01:00
committed by GitHub
parent e2a3f0f387
commit 5ddc335a7f
9 changed files with 534 additions and 39 deletions

View File

@ -94,6 +94,10 @@ ExternalProject_Add(wasm-app
socket_opts.wasm ${CMAKE_BINARY_DIR}
udp_client.wasm ${CMAKE_BINARY_DIR}
udp_server.wasm ${CMAKE_BINARY_DIR}
multicast_client.wasm ${CMAKE_BINARY_DIR}
multicast_server.wasm ${CMAKE_BINARY_DIR}
timeout_client.wasm ${CMAKE_BINARY_DIR}
timeout_server.wasm ${CMAKE_BINARY_DIR}
)
add_executable(tcp_server ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/tcp_server.c)
@ -112,6 +116,14 @@ add_executable(udp_client ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/udp_client.c)
add_executable(udp_server ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/udp_server.c)
add_executable(multicast_client ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/multicast_client.c)
add_executable(multicast_server ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/multicast_server.c)
add_executable(timeout_client ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/timeout_client.c)
add_executable(timeout_server ${CMAKE_CURRENT_SOURCE_DIR}/wasm-src/timeout_server.c)
############################################
## Build iwasm with wasi and pthread support
############################################