Tizen Sockets Extension
This article lists functions provided by Tizen Sockets Extensions for WebAssembly
http://tizen.org/privilege/internet
privilege is needed when using this extension
More information regarding theconfig.xml
file format can be found on Tizen Developers
Supported socket related functions
- accept()
- accept4()
- bind()
- close()
- connect()
- freeaddrinfo()
- getaddrinfo()
- gethostbyaddr()
- gethostbyname()
- getpeername()
- getsockname()
- getsockopt()
- listen()
- poll()
- select()
- send()
- sendmsg()
- sendto()
- setsockopt()
- socket()
- shutdown()
- read()
- recv()
- recvfrom()
- recvmsg()
- write()
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:
SOCK_NONBLOCK
andSOCK_CLOEXEC
flags when creating socket()- accept4() function
- IPv4 multicast options in getsockopt() and setsockopt().
- gethostbyaddr() function
- gethostbyname() function
accept() and accept4()
References:
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html
- https://linux.die.net/man/2/accept4
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:
- 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
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 callspoll()
(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(), becauseselect()
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 callsselect()
(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:
- 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
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:
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html
- http://man7.org/linux/man-pages/man2/socket.2.html
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: