GTXclient C API GTXserver-16.0.2

- Main Page
- Related Pages
- Data Structures
- Files
- Examples

# text_client.c example

See text_client.c source code.

This example is an interative GTXserver client. A set of actions is available each corresponding to a call to the server.

At this point, you are supposed to already know program arguments, the way to connect to and disconnect from the server and how to scroll through the Isatis filesystem. For this purpose you can refer to text_list example.

A global variable called mode represents the current state of the program. At the beginning this mode is set to INIT to say that we have no connection established.

st_menu() gives the list of available functions and gets user answer. Each answer is followed by a call to the corresponding function. The "RUN" action is used to run a server (using GTXClientRunGTXserver) on a random port and if it succeeds, connects to it. The "CONN" action is used to make the connection to an already running server and get the study list. The user can then use the "SET" action which sets an item as the current study,directory,file or variable and gets the next level list(i.e if setting a study, directory list is retrieved). The mode is then changed and new actions may be available.

For example,if we have a file list, we can get file information. If we have a variable list, and if there is a 1 bit float variable, we can set it as the current selection (In this case further reads in this file will be performed, excluding mask off samples). After setting a variable, we can get variable information or read the variable...

If the variable you have set is a macro variable, you will need to give the indice of interest before continuing. Getting variable information with GTXClientGetVariableInfo() will give you the list of available indices. You can set an indice using: GTXClientSetIndice().

To read a variable, you need to use the "STAT" action. If the variable is a character variable, GTXClientReadCharVariable() is used to read the variable. We also get the number of test values and the number of kept samples if a selection is defined. We retrieve the same parameters while reading float variables: GTXClientReadDoubleVariable(). After having read the variable, some basic statistics are written.

The "DISC" action only disconnects the server, the "EXIT" action disconnects and exits. Anyway, you have to remember that when you disconnect, the server automatically goes down if it has been started mono-session. You will not then be able to re-connect to the server interactively, without running the server again first.