.NET Client Programming

Create client programs in .NET

The MATLAB® Production Server™ .NET client API allows you to evaluate MATLAB functions on remote servers using native .NET data. The .NET client API offers the following two workflows for client-server communication.

One workflow hides the implementation details of request creation and data serialization when evaluating MATLAB functions deployed on servers. This workflow uses the MWHttpClient class and lets you choose between the following two styles of APIs to evaluate a MATLAB function.

  • Static proxy — You provide an interface that models the MATLAB function signature. This is a type-safe API that enforces passing the proper data types to the function at compile time.

  • Dynamic proxy — You pass the function name as a parameter to the proxy along with the function arguments. This defers type checking until runtime.

The other workflow uses the MATLAB Production Server RESTful API for MATLAB function execution for request creation and protocol buffers (protobuf) for data serialization. Protocol buffers are a language-neutral and platform-neutral method of serializing structured data. The MATLAB Production Server .NET client library provides helper classes to internally create protobuf messages and deserialize protobuf responses.

In an on-premises MATLAB Production Server installation, the client APIs are located in $MPS_INSTALL/client, where $MPS_INSTALL is the MATLAB Production Server installation location. The client APIs are also available at MATLAB Production Server Client Libraries.

Topics

Basics

Prepare Your Microsoft Visual Studio Environment

Set up the Microsoft® Visual Studio® environment to use the MATLAB Production Server .NET client library.

Create a .NET MATLAB Production Server Client

Learn how to create a .NET MATLAB Production Server client.

Programming Using Static and Dynamic Proxy

Create a C# Client Using MWHttpClient

Call a MATLAB function deployed to MATLAB Production Server from a C# application.

Invoke MATLAB Functions Dynamically

Invoke functions on the server without creating a proxy.

Configure the Client-Server Connection

Configure the timeout and response size limits for a client.

.NET Client Coding Best Practices

Best practices for writing .NET client code that invokes MATLAB code.

Programming Using RESTful API and Protocol Buffers for Data Serialization

Asynchronous RESTful Requests Using Protocol Buffers in .NET Client

Example that shows how to make asynchronous RESTful requests using protocol buffers in a C# client.

Synchronous RESTful Requests Using Protocol Buffers in .NET Client

Example that shows how to make synchronous RESTful requests using protocol buffers in a C# client.

Struct Support for RESTful Requests Using Protocol Buffers in .NET Client

Example that shows the support for structs as input for RESTful requests using protocol buffers in a C# client.

Inputs and Outputs

Code Multiple Outputs for C# .NET Client

Learn how to allow multiple outputs in a C# function when integrating MATLAB functions with multiple outputs.

Code Variable-Length Inputs and Outputs for .NET Client

Allow variable number of input and output arguments in a .NET client application.

Security

Access Secure Programs Using HTTPS

Connect to server instances over a secure connection.

Data Types and Data Conversion

Marshal MATLAB Structures (structs) in C#

Integrate MATLAB code that contains structures in a C# application.

Unsupported MATLAB Data Types for Client and Server Marshaling

List of supported and unsupported MATLAB data types.

Data Conversion with C# and MATLAB Types

Data type equivalents between MATLAB and C#.

Conversion Between MATLAB Types and C# Types

Data type equivalents between MATLAB and C#.