Table of Contents


marserver - communication server for mar345 IP-scanner and mardtb (desktop beamline)


marserver [ OPTION ] [ hostname ] port


marserver is a daemon-like program that talks (i.e. opens TCP/IP-sockets) to either the mar345 Imaging Plate Detector System or the marresearch desktop beamline on one side and to a suitable client program (e.g. program ’mar345dtb’) on the other side. The main purpose of the program is to replicate TCP/IP-sockets of the of the mar345 and mardtb controllers, respectively. This is a fix to the problem, that the mar345 and mardtb hardware cannot talk to more than one client at the time. If another client tries to open a new connection to the hardware, the previous socket is closed and control is lost. Program marserver opens only one socket to the corresponding port of the mar hardware but accepts multiple instances (up to 10) of connections from programs like mar345dtb. Thus, other applications that want to get the status information or native controller messages may connect to program marserver (rather than to the actual hardware) without affecting an active session of the data collection program.


-h, --help
Provides usage information

-v, --verbose
Increase verbosity level

--debug NUMBER
Sets an undocumented flag for debugging purposes.
Default: --debug 0

-dtb, --base
Connect to host (mardtb). This is the default.

-mar, --scanner
Connect to host (mar345)

Connect to port no. ’#’ or one or more of STATUS, COMMAND, DATA or MESSAGE ports.
Default: 4451 to 4454 (ALL)

-a, --add NUMBER
Accept client requests on hardware port + NUMBER
Default: --add 1000

Connect to all available hardware ports (COMM, STAT, DATA, MESS). This is the default.

-s, --status
Connect to STATUS port only

-c, --comm
Connect to COMMAND port only

-d, --data
Connect to DATA port only

-m, --mess
Connect to MESSAGE port only

Do not connect to STATUS


Do not connect to COMMAND port

Do not connect to DATA


Do not connect to MESSAGE port

-s, --swap
Force swapping of bytes when transferring bytes to/from mar hardware
Default: don’t

Mar Hardware Sockets

Program marserver may open one socket to either of the available ports of the mar hardware. If the mar hardware becomes unavailable, all hardware sockets are closed and the program pings the hardware and reopens the sockets as soon as the hardware becomes available. This would NOT affect the client sockets.

HardwarePort no.TypefIDescription
dtb4451COMMANDReads hardware commands
dtb4452STATUSSend hardware status
dtb4453DATASend ion. chamber data during alignment
dtb4454MESSAGESend native controller messages
mar3454441COMMANDReads hardware commands
mar3454442STATUSSend hardware status
mar3454443DATASend scan data
mar3454444MESSAGESend native controller messages

Client Sockets

Program marserver listens for connections of client programs on certain ports, depending on the target hardware. Up to 10 simultaneous sockets are available on each port. If a connection is closed, the program keeps listening to the port for a new connection. The client ports can be altered by command line argument -add N.

HardwarePort no.TypeDescription
dtb5451COMMANDReads hardware commands
dtb5452STATUSSend hardware status
dtb5453DATASend ion. chamber data during alignment
dtb5454MESSAGESend native controller messages
mar3455441COMMANDReads hardware commands
mar3455442STATUSSend hardware status
mar3455443DATASend scan data
mar3455444MESSAGESend native controller messages


Run marserver with mardtb hardware:
marserver -dtb

Run marserver with mar345 hardware, replicate the STATUS port only and listen to clients on port 9442 (4442+5000)

marserver -mar -s -a 5000

See Also

mar345, mar345dtb, scan345


Claudio Klein, marXperts GmbH, Norderstedt, Germany


© Copyright 2004 marXperts GmbH, Norderstedt, Germany


marXperts GmbHPhone: +49 - (40) - 529 884-0
Werkstr. 3 FAX: +49 - (40) - 529 884-20
D-22844 Norderstedt - GERMANYE-mail:

Table of Contents