Skip to content

Conversation

wenyongh
Copy link
Contributor

Refine the source code of tcp_server.c and tcp_client.c
Add building of iwasm with lib-pthread and libc-wasi enabled
Add sample document
Update iwasm --addr-pool argument description

printf("[Server] Shuting down ... \n");
printf("[Server] Shuting down ..\n");
shutdown(socket_fd, SHUT_RDWR);
close(socket_fd);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either shutdown or close, both are too much

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Start the tcp client, which connects the server and receives message.
```bash
cd build
./iwasm --addr-pool=0.0.0.0/15 tcp_client.wasm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

127.0.0.1 is better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Start the tcp server, which opens port 1234 and waits for clients to connect.
```bash
cd build
./iwasm --addr-pool=127.0.0.1/15 tcp_server.wasm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server should use 0.0.0.0 to allow it to bind to any address. Partially because the code is use 0.0.0.0.

@lum1n0us
Copy link
Collaborator

LGTM

@wenyongh wenyongh merged commit d5f4f18 into bytecodealliance:dev/socket_api Mar 10, 2022
@wenyongh wenyongh deleted the dev/socket_api branch March 10, 2022 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants