Skip to content

Server Overview

Jens De Ketelaere edited this page Oct 31, 2025 · 9 revisions

Server mode allows you to create and configure virtual Modbus servers for testing, development, and simulation.

What is Server Mode?

In Server mode, Modbux acts as a Modbus server/slave that can:

  • Simulate Modbus devices without physical hardware
  • Create multiple independent server instances
  • Configure registers with various data types
  • Generate dynamic data for realistic testing
  • Save and load server configurations

Supported Server Types

Modbus TCP Server

  • Network-based Modbus server
  • Configurable port (default: 502)
  • Multiple instances on different ports
  • Ideal for Ethernet-based testing

Future support may include Modbus RTU (serial) servers.

Key Features

Multiple Unit IDs Per Server

Each server can simulate up to 248 independent devices (Unit IDs 0-247) on a single port:

  • Each Unit ID has its own complete register configuration

    • Independent coils, discrete inputs, input registers, and holding registers
    • Different data types and values per Unit ID
    • Separate generator settings per Unit ID
  • Use cases:

    • Simulate multi-drop Modbus RTU networks (requires RTU-TCP gateway to convert TCP to RTU)
    • Test client applications that need to communicate with multiple devices
    • Create complex test scenarios with different device types on one server

Example: On port 502, you could have:

  • Unit ID 1: Temperature sensor (10 input registers)
  • Unit ID 2: Pressure sensor (5 input registers)
  • Unit ID 3: Controller (20 holding registers, 10 coils)
  • All accessible through the same IP and port, just different Unit IDs

Multiple Servers

Run up to 10 independent servers simultaneously, each on a different port. Each server can have its own set of Unit IDs.

When to Use Server Mode

Use Server mode when you need to:

  • Test client applications without physical devices
  • Develop Modbus clients with predictable test data
  • Simulate device behavior before hardware is available
  • Create training environments for learning Modbus
  • Debug communication in a controlled environment

Main Interface Components

Top Bar

image

All controls are located in a single horizontal bar at the top of the interface (left to right):

HOME BUTTON - Returns to the main Modbux home screen

OPEN - Load a saved server configuration

  • Opens JSON configuration files
  • Loads all 248 Unit IDs and their register configurations
  • Replaces current server configuration entirely

SAVE - Export current server configuration to file

  • Saves the complete server configuration to JSON
  • Includes server settings (port, name)
  • Includes all configured Unit IDs with their registers, values, generator settings, and comments

CLEAR - Reset server configuration

  • Removes all registers from all Unit IDs
  • Resets server to empty state
  • Warning: Cannot be undone

ADD/DELETE Server Buttons - Manage server instances

  • + Icon: Add new server instance (up to 10 total)
  • Trash Icon: Delete current server instance

SERVER SELECTOR - Button group to select which server instance to configure (1-10)

  • Exclusive selection: one server is always active
  • Each button displays the server's port number as text (e.g., "502", "5020")
  • Click a server button to switch to that server's configuration
  • Active server button is visually highlighted
  • Each server runs independently on its own port
  • Default main server starts on port 502

Server Name - Text input for descriptive server name

  • Helps identify servers when running multiple instances
  • Saved in configuration files

Unit ID Dropdown - Select which Unit ID to configure (0-247)

  • Critical: Each Unit ID has completely independent register configurations
  • Each Unit ID acts as a separate virtual device sharing the same IP and port
  • Switch between Unit IDs to configure different "virtual devices"
  • The register grid updates to show only the selected Unit ID's registers
  • Unit IDs with configured registers are visually highlighted in the dropdown

Port - Input field for network port (0-65535)

  • Default: 502 (standard Modbus TCP port)
  • Modbux validates port availability automatically
  • Ports must be unique per server

Important Note: Servers start automatically when configured. There is no manual start/stop control - servers are always running and ready to accept connections.

Register Containers

image

Four collapsible containers, one for each Modbus register type. All containers are visible simultaneously - click to expand/collapse:

  • Coils (Function Codes 1, 5, 15)
    • Read/write boolean (1-bit) registers
    • Typical use: Relay control, digital outputs
    • Click on bit values to toggle directly
  • Discrete Inputs (Function Code 2)
    • Read-only boolean registers
    • Typical use: Switch states, digital sensors
    • Click on bit values to toggle (for simulation purposes)
  • Input Registers (Function Code 4)
    • Read-only 16-bit numeric registers
    • Typical use: Sensor measurements, analog inputs
    • Can hold multi-register data types (32-bit, 64-bit)
  • Holding Registers (Function Codes 3, 6, 16)
    • Read/write 16-bit numeric registers
    • Typical use: Configuration, setpoints, general data storage
    • Can hold multi-register data types (32-bit, 64-bit)

Each container expands to show the register grid and an Add Register button. Collapse containers to save screen space while keeping them accessible.

Register Grid (Within Each Container)

image

Displays configured registers with the following columns:

  • LE Indicator: ONLY Shows if Little-Endian byte order is used (32/64-bit types only)
    • Default is Big-Endian (Modbus standard)
    • Toggle in register configuration
  • Address: Register address (0-65535)
    • Multi-register types show starting address
  • Data Type: Type of data stored
    • 16-bit: int16, uint16
    • 32-bit: int32, uint32, float (occupies 2 consecutive addresses)
    • 64-bit: int64, uint64, double (occupies 4 consecutive addresses)
  • Value: Current register value
    • Updates in real-time for generators
    • Can be edited directly for static values
  • Comment: User-defined description
    • Document register purpose, units, value ranges
    • Helps when sharing configurations with team members
  • Actions: Per-row action buttons
    • Edit Icon (pencil): Modify register configuration

Register Actions

Add Register Button (within each container):

  • Opens configuration dialog for new register
  • Configure: Address, Data Type, Value (Static or Generator), Comment, Endianness
  • Modbux suggests first available address automatically
  • Validates address conflicts and address space limits

Batch Clear Button (within each container):

  • Removes all registers of that type for the current Unit ID
  • Useful for quickly resetting a register type
  • Warning: Cannot be undone

Typical Workflow

  1. Select Server and Port

    • Choose server instance from dropdown (or use default)
    • Configure port number (default 502)
    • Enter descriptive server name
  2. Select Unit ID

    • Choose Unit ID from dropdown (default 0)
    • Remember: Each Unit ID represents a separate virtual device
  3. Add Registers

    • Expand the desired register type container (Coils, Discrete Inputs, Input Registers, or Holding Registers)
    • Click Add Register button
    • Configure register:
      • Address (automatically suggested)
      • Data type (int16, uint16, int32, uint32, float, int64, uint64, double)
      • Value type: Static (fixed) or Generator (dynamic random within min/max range)
      • Optional comment
    • Repeat for all needed registers
  4. Configure Multiple Unit IDs (optional)

    • Switch to different Unit ID using dropdown
    • Add registers for that Unit ID
    • Repeat for as many Unit IDs as needed
  5. Test Your Server

    • Use Split mode to open built-in client
    • In client: Connect to 127.0.0.1 using the same port
    • Read/write registers to verify configuration
    • For external clients (PLCs, SCADA): Use your PC's network IP address (e.g., 192.168.1.100:502)
  6. Save Configuration (optional)

    • Enter server name
    • Click Save button
    • Choose filename and location
    • All 248 Unit IDs and settings are saved to JSON file

Next Steps

Clone this wiki locally