Building Controls Virtual Test Bed
|
Methods for interfacing matlab using BSD sockets. More...
#include "defines.h"
Go to the source code of this file.
Functions | |
int | establishclientsocket (const char *const docname) |
Establishes a connection to the socket. More... | |
int | sendclienterror (const int *sockfd, const int *flaWri) |
Writes an error flag to the socket stream. More... | |
int | exchangedoubleswithsocket (const int *sockfd, const int *flaWri, int *flaRea, const int *nDblWri, int *nDblRea, double *simTimWri, double dblValWri[], double *simTimRea, double dblValRea[]) |
Exchanges data with the socket. More... | |
int | closeipc (int *sockfd) |
Closes the inter process communication socket. More... | |
Methods for interfacing matlab using BSD sockets.
This file provides methods that allows matlab to establish a socket connection. It is a wrapper for utilSocket.h that hides the C functions that are not exported in the dll. Without this wrapper, matlab writes warnings for each function that is not exported in the dll. The file compile.m
calls this file.
Definition in file matlabSocket.h.
int closeipc | ( | int * | sockfd | ) |
Closes the inter process communication socket.
sockfd | Socket file descripter. |
close
function.sockfd | Socket file descripter. |
Definition at line 1193 of file util/utilSocket.c.
Referenced by closeBSDSocket(), closeModelicaClient(), and main().
int establishclientsocket | ( | const char *const | docname | ) |
Establishes a connection to the socket.
This method establishes the client socket.
docname | Name of xml file that contains the socket information. |
This method establishes the client socket.
docname | Name of xml file that contains the socket information. |
Definition at line 468 of file util/utilSocket.c.
References BUFFER_LENGTH, f1, fprintf(), getsockethost(), getsocketportnumber(), REQUIRED_READ_LENGTH, REQUIRED_WRITE_LENGTH, retVal, and sockfd.
Referenced by establishBSDSocket(), establishModelicaClient(), first(), and main().
int exchangedoubleswithsocket | ( | const int * | sockfd, |
const int * | flaWri, | ||
int * | flaRea, | ||
const int * | nDblWri, | ||
int * | nDblRea, | ||
double * | simTimWri, | ||
double | dblValWri[], | ||
double * | simTimRea, | ||
double | dblValRea[] | ||
) |
Exchanges data with the socket.
Clients can call this method to exchange data through the socket.
sockfd | Socket file descripter |
flaWri | Communication flag to write to the socket stream. |
flaRea | Communication flag read from the socket stream. |
nDblWri | Number of double values to write. |
nDblRea | Number of double values to read. |
simTimWri | Current simulation time in seconds to write. |
dblValWri | Double values to write. |
simTimRea | Current simulation time in seconds read from socket. |
dblValRea | Double values read from socket. |
send
or read
, or a negative value if an error occured. Definition at line 1119 of file util/utilSocket.c.
References exchangewithsocket().
Referenced by exchangeDoublesWithBSDSocket(), exchangeModelicaClient(), first(), and main().
int sendclienterror | ( | const int * | sockfd, |
const int * | flaWri | ||
) |
Writes an error flag to the socket stream.
This method should be used by clients if they experience an error and need to terminate the socket connection.
sockfd | Socket file descripter |
flaWri | should be set to a negative value. |
This method should be used by clients if they experience an error and need to terminate the socket connection.
sendclientmessage
insteadsockfd | Socket file descripter |
flaWri | should be set to a negative value. |
This method should be used by clients if they experience an error and need to terminate the socket connection.
sendclientmessage
insteadsockfd | Socket file descripter |
flaWri | should be set to a negative value. |
Definition at line 322 of file util/utilSocket.h.
References sendclientmessage().