Tizen Sockets Extension API References

This topic lists methods provided by the Tizen Sockets Extension for WebAssembly.

Important

Thehttp://tizen.org/privilege/internet privilege is needed when using this extension.

More information regarding the "config.xml" file format and how to add privileges there can be found on Tizen Developers

When possible, the semantics of these functions conform to the POSIX.1-2017 standard. The most notable differences are:

  • Lack of signals support in Emscripten and in a web environment.

  • Tizen Sockets Extension APIs cannot be called from the main thread, which is usually the one running the main function unless -s PROXY_TO_PTHREAD or --proxy-to-worker flags are provided to Emscripten during link time. See Additional flags in the Emscripten documentation.

  • Socket functions that accept multiple descriptors can accept only one descriptor type at a time. Descriptor types cannot be mixed (meaning that a method can be called with either socket descriptors or file descriptors, but not both). In particular, this applies to poll() and select() methods.

  • select() method can be slow due to its internal implementation in Emscripten. It is recommended to use poll() method instead.

The following extensions to sockets are provided:

Table 1: Tizen Sockets Extension Methods
Method Argument Value Reference
accept() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html
accept4() Values in flags:
  • SOCK_NONBLOCK
  • SOCK_CLOEXEC
https://linux.die.net/man/2/accept4
bind() - https://linux.die.net/man/2/accept4https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html
close() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
connect() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
freeaddrinfo() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html
getaddrinfo() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html
gethostbyaddr() - https://linux.die.net/man/3/gethostbyaddr
gethostbyname() https://linux.die.net/man/3/gethostbyname
getpeername() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html
getsockname() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html
getsockopt() Combinations of level and optname:
  • SOL_SOCKET, SO_DEBUG
  • SOL_SOCKET, SO_ERROR
  • SOL_SOCKET, SO_BROADCAST
  • SOL_SOCKET, SO_REUSEADDR
  • SOL_SOCKET, SO_KEEPALIVE
  • SOL_SOCKET, SO_OOBINLINE
  • SOL_SOCKET, SO_SNDBUF
  • SOL_SOCKET, SO_RCVBUF
  • SOL_SOCKET, SO_DONTROUTE
  • SOL_SOCKET, SO_RCVLOWAT
  • SOL_SOCKET, SO_SNDLOWAT
  • SOL_SOCKET, SO_RCVTIMEO
  • SOL_SOCKET, SO_SNDTIMEO
  • SOL_SOCKET, SO_LINGER
  • IPPROTO_TCP, TCP_NODELAY
  • IPPROTO_IP, IP_MULTICAST_LOOP
  • IPPROTO_IP, IP_MULTICAST_TTL
  • IPPROTO_IPV6, IPV6_MULTICAST_HOPS
  • IPPROTO_IPV6, IPV6_MULTICAST_LOOP
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
https://www.tldp.org/HOWTO/Multicast-HOWTO-6.html
http://man7.org/linux/man-pages/man7/ip.7.html
listen() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html
poll() Supported event flags:
  • POLLIN
  • POLLRDNORM
  • POLLRDBAND
  • POLLPRI
  • POLLOUT
  • POLLWRNORM
  • POLLWRBAND
  • POLLERR
  • POLLHUP
  • POLLNVAL
Usage notes:
  • The Tizen Sockets Extension for WebAssembly does not support mixing descriptor types in poll() calls. An application must use only one type of descriptors each time it calls poll() (to pass either socket descriptors or file descriptors as arguments of a single call, never both).
  • It is recommended to use poll() over select(), because the internalselect() implementation in the Samsung Emscripten SDK can be slow.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html
read() https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html
recv() Values in flags:
  • MSG_PEEK
  • MSG_OOB
  • MSG_WAITALL
https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html
recvfrom() Values in flags:
  • MSG_PEEK
  • MSG_OOB
  • MSG_WAITALL
https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html
recvmsg() Values in flags:
  • MSG_PEEK
  • MSG_OOB
  • MSG_WAITALL
https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html
select() Usage notes:
  • The Tizen Sockets Extension for WebAssembly does not support mixing descriptor types in select() calls. An application must use only one type of descriptors each time it calls select() (to pass either socket descriptors or file descriptors as arguments of a single call, never both).
  • The select() method can be slow due to its internal implementation in the Samsung Emscripten SDK. It is recommended to use poll() instead.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html
send() Values in flags:
  • MSG_EOR
  • MSG_OOB
  • MSG_NOSIGNAL
https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html
sendmsg() Values in flags:
  • MSG_EOR
  • MSG_OOB
  • MSG_NOSIGNAL
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
sendto() Values in flags:
  • MSG_EOR
  • MSG_OOB
  • MSG_NOSIGNAL
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html
setsockopt() Combinations of level and optname:
  • SOL_SOCKET, SO_DEBUG,
  • SOL_SOCKET, SO_BROADCAST
  • SOL_SOCKET, SO_REUSEADDR
  • SOL_SOCKET, SO_KEEPALIVE
  • SOL_SOCKET, SO_OOBINLINE
  • SOL_SOCKET, SO_SNDBUF
  • SOL_SOCKET, SO_RCVBUF
  • SOL_SOCKET, SO_DONTROUTE
  • SOL_SOCKET, SO_RCVLOWAT
  • SOL_SOCKET, SO_SNDLOWAT
  • SOL_SOCKET, SO_RCVTIMEO
  • SOL_SOCKET, SO_SNDTIMEO
  • SOL_SOCKET, SO_LINGER
  • IPPROTO_TCP, TCP_NODELAY
  • IPPROTO_IP, IP_MULTICAST_LOOP
  • IPPROTO_IP, IP_MULTICAST_TTL
  • IPPROTO_IP, IP_ADD_MEMBERSHIP
  • IPPROTO_IP, IP_ADD_SOURCE_MEMBERSHIP
  • IPPROTO_IP, IP_BLOCK_SOURCE
  • IPPROTO_IP, IP_DROP_MEMBERSHIP
  • IPPROTO_IP, IP_DROP_SOURCE_MEMBERSHIP
  • IPPROTO_IP, IP_UNBLOCK_SOURCE
  • IPPROTO_IPV6, IPV6_MULTICAST_HOPS
  • IPPROTO_IPV6, IPV6_MULTICAST_LOOP
  • IPPROTO_IPV6, IPV6_JOIN_GROUP
  • IPPROTO_IPV6, IPV6_LEAVE_GROUP
https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
https://www.tldp.org/HOWTO/Multicast-HOWTO-6.html
http://man7.org/linux/man-pages/man7/ip.7.html
shutdown() Values in how:
  • SHUT_RD
  • SHUT_WR
  • SHUT_RDWR
https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html
socket() Values in domain:
  • AF_INET
  • AF_INET6
Values in type:
  • SOCK_STREAM
  • SOCK_DGRAM
Flags bitwise ORed with type argument:
  • SOCK_CLOEXEC
  • SOCK_NONBLOCK
https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html
http://man7.org/linux/man-pages/man2/socket.2.html
write() - https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html