emscripten-core / emscripten-core/emscripten
tests/websocket/tcp_echo_client.cpp not works
- Lingua principale
- C++
- Stelle
- 27.6k
- Fork
- 3.6k
- Merge medio
- 1g 14h
- PR unite (30g)
- 125
Descrizione
Hi,
I tried to setup a wasm socket client and communicate with a TCP socket server.
it seems wasm socket could not communicate directly with TCP socket, I need to setup a socket proxy server to make it work.
I checked the guide here https://emscripten.org/docs/porting/networking.html#full-posix-sockets-over-websocket-proxy-server
and tried to run the sample in tests/websocket/tcp_echo_client.cpp, but it not works.
My steps is :
1. build tools/websocket_to_posix_proxy:
mkdir build
cd build
cmake ..
make
then I got the binary file websocket_to_posix_proxy in build folder
2. build tests/websocket/tcp_echo_client.cpp with command:
emcc tcp_echo_client.cpp -lwebsocket.js -s PROXY_POSIX_SOCKETS=1 -s USE_PTHREADS=1 -s PROXY_TO_PTHREAD=1 -o client.js
3. run the proxy with command: ./websocket_to_posix_proxy 8080
there's log:
websocket_to_posix_proxy server is now listening for WebSocket connections to ws://localhost:8080/
4. run client with command:
node --experimental-wasm-threads --experimental-wasm-bulk-memory client.js
the issue is: emscripten_websocket_get_ready_state(bridgeSocket, &readyState); the readyState always 0.
is anybody know the reason? is there any issue with my steps?
thank you very much!
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia riproducendo i comandi in tests/websocket/tcp_echo_client.cpp con tools/websocket_to_posix_proxy, inclusi i passaggi per il proxy e il client Node. Traccia il motivo per cui emscripten_websocket_get_ready_state restituisce 0; il lavoro è completato quando l’esempio raggiunge lo stato pronto previsto e comunica con il server TCP tramite il proxy.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, wasm
- Ambito
- networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 28/100