Class WasiServerSocket

    • Constructor Detail

      • WasiServerSocket

        public WasiServerSocket()
                         throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • bind

        public void bind​(java.net.InetSocketAddress addr)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • listen

        public void listen​(int backlog)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • accept

        @Nullable
        public WasiSocket accept()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getLocalSocketAddress

        @Nullable
        public java.net.SocketAddress getLocalSocketAddress()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • canAccept

        public boolean canAccept()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getType

        public FileType getType()
        Description copied from interface: WasiIO
        Gets the WasiIO file descriptor type.
        Specified by:
        getType in interface WasiIO
        Returns:
        the WasiIO file descriptor type.
      • setNonBlocking

        public void setNonBlocking​(boolean nonBlocking)
                            throws java.io.IOException
        Description copied from interface: WasiSocketOpt
        Enable/disable the non blocking state on this WasiIO
        Specified by:
        setNonBlocking in interface WasiSocketOpt
        Parameters:
        nonBlocking - whether to enable or disable the non-blocking socket option
        Throws:
        java.io.IOException - if an I/O error occurs.
      • setBroadcast

        public void setBroadcast​(boolean on)
                          throws java.io.IOException
        Description copied from interface: WasiSocketOpt
        Enable/disable the SO_BROADCAST socket option. Only meaningful for datagram sockets; stream sockets should ignore this call.
        Specified by:
        setBroadcast in interface WasiSocketOpt
        Parameters:
        on - whether to enable or disable broadcast
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getBroadcast

        public boolean getBroadcast()
                             throws java.io.IOException
        Description copied from interface: WasiSocketOpt
        Get the SO_BROADCAST socket option. Only meaningful for datagram sockets; stream and server sockets always return false.
        Specified by:
        getBroadcast in interface WasiSocketOpt
        Returns:
        whether broadcast is enabled
        Throws:
        java.io.IOException - if an I/O error occurs.
      • setReuseAddress

        public void setReuseAddress​(boolean on)
                             throws java.io.IOException
        Description copied from interface: WasiSocketOpt
        Enable/disable the reuse address socket option.
        Specified by:
        setReuseAddress in interface WasiSocketOpt
        Parameters:
        on - whether to enable or disable the reuse address socket option
        Throws:
        java.io.IOException - if an I/O error occurs.
      • setReceiveBufferSize

        public void setReceiveBufferSize​(int size)
                                  throws java.io.IOException
        Description copied from interface: WasiSocketOpt
        Set the receive buffer size (SO_RCVBUF).
        Specified by:
        setReceiveBufferSize in interface WasiSocketOpt
        Parameters:
        size - the buffer size in bytes
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getReceiveBufferSize

        public int getReceiveBufferSize()
                                 throws java.io.IOException
        Description copied from interface: WasiSocketOpt
        Get the receive buffer size (SO_RCVBUF).
        Specified by:
        getReceiveBufferSize in interface WasiSocketOpt
        Returns:
        the buffer size in bytes
        Throws:
        java.io.IOException - if an I/O error occurs.
      • setSendBufferSize

        public void setSendBufferSize​(int size)
                               throws java.io.IOException
        Description copied from interface: WasiSocketOpt
        Set the send buffer size (SO_SNDBUF).
        Specified by:
        setSendBufferSize in interface WasiSocketOpt
        Parameters:
        size - the buffer size in bytes
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getSendBufferSize

        public int getSendBufferSize()
                              throws java.io.IOException
        Description copied from interface: WasiSocketOpt
        Get the send buffer size (SO_SNDBUF).
        Specified by:
        getSendBufferSize in interface WasiSocketOpt
        Returns:
        the buffer size in bytes
        Throws:
        java.io.IOException - if an I/O error occurs.