Tizen Sockets Extension

This article lists functions provided by Tizen Sockets Extensions for WebAssembly

When possible semantics of these functions conform to POSIX.1-2017.

Most notable differences are:

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

Following extensions to sockets are provided:

accept() and accept4()

References:

Supported flags in accept4():

  • SOCK_NONBLOCK
  • SOCK_CLOEXEC

bind()

References:

close()

References:

connect()

References:

freeaddrinfo()

References:

getaddrinfo()

References:

gethostbyaddr()

References:

gethostbyname()

References:

getpeername()

References:

getsockname()

References:

getsockopt()

References:

Supported level and optname combinations:

  • 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

listen()

References:

poll()

References:

Supported event flags:

  • POLLIN
  • POLLRDNORM
  • POLLRDBAND
  • POLLPRI
  • POLLOUT
  • POLLWRNORM
  • POLLWRBAND
  • POLLERR
  • POLLHUP
  • POLLNVAL

Usage notes:

  • Tizen Sockets Extension for WebAssembly does not support mixing various types of descriptors in poll() calls. Application must use only one type of descriptors each time it calls poll() (e.g. pass either only socket descriptors or only file descriptors as arguments of a single call).
  • It is recommended to use poll() over select(), because select() internal implementation in Emscripten may be slow.

select()

References:

Usage notes:

  • Tizen Sockets Extension for WebAssembly does not support mixing various types of descriptors in select() calls. Application must use only one type of descriptors each time it calls select() (e.g. pass either only socket descriptors or only file descriptors as arguments of a single call).
  • select() can be slow due to its internal implementation in Emscripten. It is recommended to use poll() instead.

send()

References:

Supported flags:

  • MSG_EOR
  • MSG_OOB
  • MSG_NOSIGNAL

sendmsg()

References:

Supported flags:

  • MSG_EOR
  • MSG_OOB
  • MSG_NOSIGNAL

sendto()

References:

Supported flags:

  • MSG_EOR
  • MSG_OOB
  • MSG_NOSIGNAL

setsockopt()

References:

Supported level and optname combinations:

  • 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

shutdown()

References:

Supported how values:

  • SHUT_RD
  • SHUT_WR
  • SHUT_RDWR

socket()

References:

Supported domain values:

  • AF_INET
  • AF_INET6

Supported type:

  • SOCK_STREAM
  • SOCK_DGRAM

Flags bitwise ORed with type argument:

  • SOCK_CLOEXEC
  • SOCK_NONBLOCK

read()

References:

recv()

References:

Supported flags:

  • MSG_PEEK
  • MSG_OOB
  • MSG_WAITALL

recvfrom()

References:

Supported flags:

  • MSG_PEEK
  • MSG_OOB
  • MSG_WAITALL

recvmsg()

References:

Supported flags:

  • MSG_PEEK
  • MSG_OOB
  • MSG_WAITALL

write()

References: