The Socket API in Emscripten is a wrapper around WebSockets, not POSIX 
sockets. From the source code side it looks and behaves roughly like a 
non-blocking POSIX socket, but the underlying protocol is WebSocket, and 
incompatible to TCP or UDP, meaning you can't connect to a native TCP or 
UDP port, only to a WebSocket port.

To connect to a TCP port, you'll need a WebSocket-to-TCP proxy on the 
server-side like Gorilla WebSocket (https://github.com/gorilla/websocket) 
or Websockify (https://github.com/novnc/websockify).

I'm not aware of a WebSocket to UDP proxy though, instead AFAIK for UDP 
connections, the recommended solution is to use a higher level networking 
library which sits on top of WebRTC data channels, like ENet or HumbleNet.

On Monday, 20 June 2022 at 15:03:54 UTC+2 [email protected] wrote:

> Hi, 
>
> I am trying the communication between Posix's UDP server & emscripten 's 
> client.
>
> i.e both uses almost same POSIX socket APIs
>
> Posix's UDP server - Compiled with LINUX GCC 
>
>  emscripten 's client - compiled with emcc tool
>
>  Both the applications are sending message through sendto() is success. 
> But other client is not receiving them. What would be the issue ?
>
> Do we have any sample code ?
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/de86e346-ca3f-4077-88ec-a4a8aa3a05c6n%40googlegroups.com.

Reply via email to