Building Controls Virtual Test Bed
|
#include "utilSocket.h"
Go to the source code of this file.
Functions | |
int | getsocketportnumber (const char *const docname) |
Gets the port number for the BSD socket communication. More... | |
int | getmainversionnumber () |
Returns the version number. More... | |
int | establishclientsocket (const char *const docname) |
Establishes a connection to the socket. More... | |
int | sendclientmessage (const int *sockfd, const int *flaWri) |
Writes a message 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... | |
int | main (int argc, const char *argv[]) |
int closeipc | ( | int * | sockfd | ) |
Closes the inter process communication socket.
sockfd | Socket file descripter. |
Definition at line 186 of file dummy/utilSocket.c.
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. |
Definition at line 130 of file dummy/utilSocket.c.
References BUFFER_LENGTH, f1, fprintf(), getsockethost(), getsocketportnumber(), REQUIRED_READ_LENGTH, REQUIRED_WRITE_LENGTH, retVal, and sockfd.
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 169 of file dummy/utilSocket.c.
References exchangewithsocket().
int getmainversionnumber | ( | ) |
Returns the version number.
Returns the main version number.
Returns the main version number of the client.
This method returns the version number. A negative return value is used in a dummy dll to check in EnergyPlus whether the BCVTB has been installed.
Definition at line 119 of file dummy/utilSocket.c.
References MAINVERSION.
int getsocketportnumber | ( | const char *const | docname | ) |
Gets the port number for the BSD socket communication.
This method parses the xml file for the socket number.
docname | Name of xml file. |
Definition at line 107 of file dummy/utilSocket.c.
References BUFFER_LENGTH, f1, fprintf(), getxmlvalue(), i, and retVal.
int main | ( | int | argc, |
const char * | argv[] | ||
) |
Definition at line 191 of file dummy/utilSocket.c.
int sendclientmessage | ( | const int * | sockfd, |
const int * | flaWri | ||
) |
Writes a message flag to the socket stream.
This method should be used by clients if they need to send a flag to the BCVTB.
The flag flaWri is defined as follows: +1: simulation reached end time. -1: simulation terminates due to an (unspecified) error. -10: simulation terminates due to error during initialization. -20: simulation terminates due to error during time integration.
sockfd | Socket file descripter |
flaWri | Flag to be sent to the BCVTB |
Definition at line 150 of file dummy/utilSocket.c.
References f1, fprintf(), readbufferfromsocket(), REQUIRED_READ_LENGTH, retVal, and writetosocket().
Referenced by sendclienterror().