That test might be faulty, it was just updated in fact to fix the USE_UDP option.
In any case, when using websockets, we "allow" UDP but it works much like TCP - we can't drop packets etc. But code using UDP will mostly work. This support is present to avoid code rewrites for people. There is also proper WebRTC support which can do UDP in a lossy way, see tests/test_browser.py and search for webrtc. - Alon On Mon, Jan 27, 2014 at 11:00 PM, ShunXung Yang <[email protected]> wrote: > Hi all, > > I have some questions about socket testcase in emscripten/tests/sockets/ > folder. > > There is a socket echo client/sever test case.( > *test_sockets_echo_client.c* *+ test_sockets_echo_server.c*) > > and I found that there is a flag "USE_UDP" in code section. > --------------------------------------------------------------------------- > #if !USE_UDP > server.fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); > #else > server.fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); > #endif > > ---------------------------------------------------------------------------- > So I want to check the difference between TCP&UDP after emcc compiled. > > *# emcc -DUSE_UDP test_sockets_echo_client.c -o test_UDP.js* > > > *# emcc test_sockets_echo_client.c -o test_TCP.js# diff test_UDP.js > test_TCP.js*6337c6337 > < var $7=_socket(2,2,17); > --- > > var $7=_socket(2,1,6); > 9744c9744 > < //@ sourceMappingURL=test_UDP.js.map > ---- > > //@ sourceMappingURL=test_TCP.js.map > > I find that both compiled js use websocket, but in my understanding > websocket is based on TCP. > > So there is no difference between tcp/udp after emcc compiled?? > > and I saw some previous topics in this group and there is "webrtc" baesd > on tcp&udp, > > but how can emcc compile udp to js using webrtc? > > thanks. > > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
