<commit_before># Matlab Network Server

A dead-simple library for implementing a request-response server in Matlab.

## Usage example

Write a function to implement the server.

```matlab
function response = my_server(request)
    % create a Matlab object to be returned to the client
    response.message = ['Hello ' request];
end
```

Start the server, passing a callback function.

```
>> netsrv.start_server(@my_server, 8148);
```

On another machine, send requests to the server.

```
>> netsrv.start_client('localhost', 8148)
Opening ZMQ socket tcp://localhost:8148
```

```
>> netsrv.make_request('Dave)
ans =
    message: 'Hello Dave'
```

## Features

* Can send arbitrary Matlab objects.
* Uses the high performance [ZeroMQ](http://zeromq.org/) library for messaging. The server can handle many simultaneous client connections.

## Installing

Clone the repository into a directory beginning with a `+` symbol to create a Matlab package. The suggested name is `+netsrv`

    $ git clone https://github.com/bronsonp/matlab-network-server.git +netsrv

Install the ZeroMQ library.

    $ sudo apt-get install libzmq3-dev

Compile the C++ code.

    $ cd +netsrv/private
    $ make

If the build fails, you need to [set up the MEX compiler](http://www.mathworks.com.au/help/matlab/matlab_external/building-mex-files.html).

## Credits

Serialization is provided by the `hlp_serialize` code written by <NAME> and published on the [Mathworks File Exchange](http://www.mathworks.com.au/matlabcentral/fileexchange/34564-fast-serializedeserialize/content/hlp_serialize.m).

Messaging is provided by the [ZeroMQ](http://zeromq.org) library.<commit_msg>Added Windows instructions to README<commit_after># Matlab Network Server

A dead-simple library for implementing a request-response server in Matlab.

## Usage example

Write a function to implement the server.

```matlab
function response = my_server(request)
    % create a Matlab object to be returned to the client
    response.message = ['Hello ' request];
end
```

Start the server, passing a callback function.

```
>> netsrv.start_server(@my_server, 8148);
```

On another machine, send requests to the server.

```
>> netsrv.start_client('localhost', 8148)
Opening ZMQ socket tcp://localhost:8148
```

```
>> netsrv.make_request('Dave)
ans =
    message: 'Hello Dave'
```

## Features

* Can send arbitrary Matlab objects.
* Uses the high performance [ZeroMQ](http://zeromq.org/) library for messaging. The server can handle many simultaneous client connections.

## Installing (Linux)

Clone the repository into a directory beginning with a `+` symbol to create a Matlab package. The suggested name is `+netsrv`

    $ git clone https://github.com/bronsonp/matlab-network-server.git +netsrv

Install the ZeroMQ library.

    $ sudo apt-get install libzmq3-dev

Compile the C++ code.

    $ cd +netsrv/private
    $ make

If the build fails, you need to [set up the MEX compiler](http://www.mathworks.com.au/help/matlab/matlab_external/building-mex-files.html).

## Installing (Windows)

1. Clone the repository into a directory beginning with a `+` symbol to create a Matlab package.
2. Download the [installer for ZeroMQ version 3](http://zeromq.org/distro:microsoft-windows).
3. Run the `compile_for_windows.m` script in the `private` subdirectory.

If the build fails, you need to [set up the MEX compiler](http://www.mathworks.com.au/help/matlab/matlab_external/building-mex-files.html).

## Credits

Serialization is provided by the `hlp_serialize` code written by <NAME> and published on the [Mathworks File Exchange](http://www.mathworks.com.au/matlabcentral/fileexchange/34564-fast-serializedeserialize/content/hlp_serialize.m).

Messaging is provided by the [ZeroMQ](http://zeromq.org) library.
{'fraction_non_alphanumeric': 0.10833775889537971, 'fraction_numerical': 0.010621348911311737, 'mean_word_length': 4.4045911047345765, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 5, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3416360', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1112, 'n_words': 387}