Class RMTSettings

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class RMTSettings
    extends Struct
    implements NativeResource
    Structure to fill in to modify Remotery default settings.

    Member documentation

    • port – which port to listen for incoming connections on
    • reuse_open_port – when this server exits it can leave the port open in TIME_WAIT state for a while. This forces subsequent server bind attempts to fail when restarting. If you find restarts fail repeatedly with bind attempts, set this to true to forcibly reuse the open port.
    • limit_connections_to_localhost – Only allow connections on localhost?

      For dev builds you may want to access your game from other devices but if you distribute a game to your players with Remotery active, probably best to limit connections to localhost.

    • msSleepBetweenServerUpdates – how long to sleep between server updates, hopefully trying to give a little CPU back to other threads
    • messageQueueSizeInBytes – size of the internal message queues Remotery uses. Will be rounded to page granularity of 64k.
    • maxNbMessagesPerUpdate – if the user continuously pushes to the message queue, the server network code won't get a chance to update unless there's an upper-limit on how many messages can be consumed per loop
    • _malloc – callback pointer for memory allocation
    • realloc – callback pointer for memory allocation
    • _free – callback pointer for memory allocation
    • mm_context – memory allocation context pointer
    • input_handler – callback pointer for receiving input from the Remotery console
    • input_handler_context – context pointer that gets sent to Remotery console callback function

    Layout

    
     struct rmtSettings {
         rmtU16 port;
         rmtBool reuse_open_port;
         rmtBool limit_connections_to_localhost;
         rmtU32 msSleepBetweenServerUpdates;
         rmtU32 messageQueueSizeInBytes;
         rmtU32 maxNbMessagesPerUpdate;
         rmtMallocPtr _malloc;
         rmtReallocPtr realloc;
         rmtFreePtr _free;
         void * mm_context;
         rmtInputHandlerPtr input_handler;
         void * input_handler_context;
         rmtPStr logFilename;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • PORT, REUSE_OPEN_PORT, LIMIT_CONNECTIONS_TO_LOCALHOST, MSSLEEPBETWEENSERVERUPDATES, MESSAGEQUEUESIZEINBYTES, MAXNBMESSAGESPERUPDATE, _MALLOC, REALLOC, _FREE, MM_CONTEXT, INPUT_HANDLER, INPUT_HANDLER_CONTEXT, LOGFILENAME

        The struct member offsets.
    • Constructor Detail

      • RMTSettings

        public RMTSettings​(java.nio.ByteBuffer container)
        Creates a RMTSettings instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • port

        public short port()
        Returns the value of the port field.
      • reuse_open_port

        public int reuse_open_port()
        Returns the value of the reuse_open_port field.
      • limit_connections_to_localhost

        public int limit_connections_to_localhost()
        Returns the value of the limit_connections_to_localhost field.
      • msSleepBetweenServerUpdates

        public int msSleepBetweenServerUpdates()
        Returns the value of the msSleepBetweenServerUpdates field.
      • messageQueueSizeInBytes

        public int messageQueueSizeInBytes()
        Returns the value of the messageQueueSizeInBytes field.
      • maxNbMessagesPerUpdate

        public int maxNbMessagesPerUpdate()
        Returns the value of the maxNbMessagesPerUpdate field.
      • _malloc

        public RMTMalloc _malloc()
        Returns the value of the _malloc field.
      • realloc

        public RMTRealloc realloc()
        Returns the value of the realloc field.
      • _free

        public RMTFree _free()
        Returns the value of the _free field.
      • mm_context

        public long mm_context()
        Returns the value of the mm_context field.
      • input_handler

        public RMTInputHandler input_handler()
        Returns the value of the input_handler field.
      • input_handler_context

        public long input_handler_context()
        Returns the value of the input_handler_context field.
      • logFilename

        public java.nio.ByteBuffer logFilename()
        Returns a ByteBuffer view of the null-terminated string pointed to by the logFilename field.
      • logFilenameString

        public java.lang.String logFilenameString()
        Decodes the null-terminated string pointed to by the logFilename field.
      • port

        public RMTSettings port​(short value)
        Sets the specified value to the port field.
      • reuse_open_port

        public RMTSettings reuse_open_port​(int value)
        Sets the specified value to the reuse_open_port field.
      • limit_connections_to_localhost

        public RMTSettings limit_connections_to_localhost​(int value)
        Sets the specified value to the limit_connections_to_localhost field.
      • msSleepBetweenServerUpdates

        public RMTSettings msSleepBetweenServerUpdates​(int value)
        Sets the specified value to the msSleepBetweenServerUpdates field.
      • messageQueueSizeInBytes

        public RMTSettings messageQueueSizeInBytes​(int value)
        Sets the specified value to the messageQueueSizeInBytes field.
      • maxNbMessagesPerUpdate

        public RMTSettings maxNbMessagesPerUpdate​(int value)
        Sets the specified value to the maxNbMessagesPerUpdate field.
      • _malloc

        public RMTSettings _malloc​(RMTMallocI value)
        Sets the specified value to the _malloc field.
      • _free

        public RMTSettings _free​(RMTFreeI value)
        Sets the specified value to the _free field.
      • mm_context

        public RMTSettings mm_context​(long value)
        Sets the specified value to the mm_context field.
      • input_handler_context

        public RMTSettings input_handler_context​(long value)
        Sets the specified value to the input_handler_context field.
      • logFilename

        public RMTSettings logFilename​(java.nio.ByteBuffer value)
        Sets the address of the specified encoded string to the logFilename field.
      • set

        public RMTSettings set​(short port,
                               int reuse_open_port,
                               int limit_connections_to_localhost,
                               int msSleepBetweenServerUpdates,
                               int messageQueueSizeInBytes,
                               int maxNbMessagesPerUpdate,
                               RMTMallocI _malloc,
                               RMTReallocI realloc,
                               RMTFreeI _free,
                               long mm_context,
                               RMTInputHandlerI input_handler,
                               long input_handler_context,
                               java.nio.ByteBuffer logFilename)
        Initializes this struct with the specified values.
      • set

        public RMTSettings set​(RMTSettings src)
        Copies the specified struct data to this struct.
        Parameters:
        src - the source struct
        Returns:
        this struct
      • create

        public static RMTSettings create​(long address)
        Returns a new RMTSettings instance for the specified memory address.
      • createSafe

        @Nullable
        public static RMTSettings createSafe​(long address)
        Like create, but returns null if address is NULL.
      • callocStack

        public static RMTSettings callocStack()
        Returns a new RMTSettings instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • callocStack

        public static RMTSettings callocStack​(MemoryStack stack)
        Returns a new RMTSettings instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • nport

        public static short nport​(long struct)
        Unsafe version of port().
      • nreuse_open_port

        public static int nreuse_open_port​(long struct)
        Unsafe version of reuse_open_port().
      • nmsSleepBetweenServerUpdates

        public static int nmsSleepBetweenServerUpdates​(long struct)
      • nmessageQueueSizeInBytes

        public static int nmessageQueueSizeInBytes​(long struct)
        Unsafe version of messageQueueSizeInBytes().
      • nmaxNbMessagesPerUpdate

        public static int nmaxNbMessagesPerUpdate​(long struct)
        Unsafe version of maxNbMessagesPerUpdate().
      • n_malloc

        public static RMTMalloc n_malloc​(long struct)
        Unsafe version of _malloc().
      • n_free

        public static RMTFree n_free​(long struct)
        Unsafe version of _free().
      • nmm_context

        public static long nmm_context​(long struct)
        Unsafe version of mm_context().
      • ninput_handler_context

        public static long ninput_handler_context​(long struct)
        Unsafe version of input_handler_context().
      • nlogFilename

        public static java.nio.ByteBuffer nlogFilename​(long struct)
        Unsafe version of logFilename().
      • nlogFilenameString

        public static java.lang.String nlogFilenameString​(long struct)
        Unsafe version of logFilenameString().
      • nport

        public static void nport​(long struct,
                                 short value)
        Unsafe version of port.
      • nreuse_open_port

        public static void nreuse_open_port​(long struct,
                                            int value)
        Unsafe version of reuse_open_port.
      • nlimit_connections_to_localhost

        public static void nlimit_connections_to_localhost​(long struct,
                                                           int value)
      • nmsSleepBetweenServerUpdates

        public static void nmsSleepBetweenServerUpdates​(long struct,
                                                        int value)
        Unsafe version of msSleepBetweenServerUpdates.
      • nmessageQueueSizeInBytes

        public static void nmessageQueueSizeInBytes​(long struct,
                                                    int value)
        Unsafe version of messageQueueSizeInBytes.
      • nmaxNbMessagesPerUpdate

        public static void nmaxNbMessagesPerUpdate​(long struct,
                                                   int value)
        Unsafe version of maxNbMessagesPerUpdate.
      • n_malloc

        public static void n_malloc​(long struct,
                                    RMTMallocI value)
        Unsafe version of _malloc.
      • nrealloc

        public static void nrealloc​(long struct,
                                    RMTReallocI value)
        Unsafe version of realloc.
      • n_free

        public static void n_free​(long struct,
                                  RMTFreeI value)
        Unsafe version of _free.
      • nmm_context

        public static void nmm_context​(long struct,
                                       long value)
        Unsafe version of mm_context.
      • ninput_handler_context

        public static void ninput_handler_context​(long struct,
                                                  long value)
        Unsafe version of input_handler_context.
      • nlogFilename

        public static void nlogFilename​(long struct,
                                        java.nio.ByteBuffer value)
        Unsafe version of logFilename.
      • validate

        public static void validate​(long struct)
        Validates pointer members that should not be NULL.
        Parameters:
        struct - the struct to validate
      • validate

        public static void validate​(long array,
                                    int count)
        Calls validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array