Tizen Sockets Extenstion

This section provides an overview of Tizen Sockets Extension, allowing low-level socket access. This feature allows building real time media streaming applications that can use protocols like RTP/RTSP.

Socket functions can be called from a JavaScript Worker thread.


Related Info


Samples


The Tizen Sockets Extension is a Samsung extension API which grants a WebAssembly application low-level access to Tizen platform sockets. It offers high bandwidth and low latency for the TCP and UDP connection protocols.
An example use case is applications using real-time multimedia streaming (using the RTP/RTSP protocol). One such sample application is Moonlight GameStreaming (its source code can be found on github. Moonlight was presented at SDC2019.
For an example on using the Tizen Sockets Extension in practice, see Building cURL Applications Using CLI Tools and Building cURL Applications Using Tizen Studio.

Differences Between Tizen Sockets Extension and POSIX

Where possible, the semantics of the Tizen Sockets Extension methods conform to POSIX.1-2017. The most notable differences are:

  • Emscripten and the Web environment lack signal support.
  • Tizen Sockets Extension APIs cannot be called from the main thread, which is usually the one running the main function, unless the -s PROXY_TO_PTHREAD or --proxy-to-worker flags were provided to Emscripten during link time. See the Additional flags chapter in the Emscripten documentation.
  • Socket methods that accept multiple descriptors can accept only one descriptor type at a time. Descriptor types cannot be mixed (for example, a function can be called with either socket descriptors or file descriptors, but not both). In particular, this applies to poll() and select() methods.
  • The select() method can be slow due to its internal implementation in Emscripten. It is recommended to use poll() instead.

The following extensions to sockets are provided:

  • SOCK_NONBLOCK and SOCK_CLOEXEC flags when creating socket()
  • accept4() method
  • IPv4 multicast options in getsockopt() and setsockopt().
  • gethostbyaddr() method
  • gethostbyname() method