You can enhance the power and flexibility of your TCP/IP client by using events and callbacks. An event occurs after a condition is met and can result in one or more callbacks.
While MATLAB® is connected to a remote host with a TCP/IP client, you can use events to display a message, display data, analyze data, and so on. You can control callbacks through callback properties and callback functions. All event types have an associated callback property. Callback functions are MATLAB functions that you write to suit your specific application needs. Execute a callback when a particular event occurs by specifying the name of the callback function as the value for the associated callback property.
For an example of configuring callbacks with the
tcpclient object, see
Communicate Binary and ASCII Data to an Echo Server Using TCP/IP.
tcpclient properties and functions associated with callbacks
|Property or Function||Purpose|
|Number of bytes available to read|
|Bytes available callback function|
|Number of bytes of data to trigger callback|
|Bytes available callback trigger mode|
|Set callback function and trigger condition for communication with remote host over TCP/IP|
|Callback function triggered by error event|
|General purpose property for user data|