Co-simulation with the Libcosim Library > Use with third-party applications > API Documentation
amecommunication_socket.c File Reference
Copy
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "amecommunication_socket.h"
Include dependency graph for amecommunication_socket.c:
Functions
Copy
int amesock_init (amesock_conn_attributes *connection, int isserver, char *server_name, int port, int input_size, int output_size)
int amesock_exchange (amesock_conn_attributes *connection, double *input, double *output)
int amesock_close (amesock_conn_attributes *connection)
Function Documentation
| int amesock_init (amesock_conn_attributes * connection, int isserver, char * server_name, int port, int input_size, int output_size) | |
|---|---|
| Exchanges data between the slave and the master. | |
| Parameters | connection [OUT] contains the information needed by amesock_exchange(). isserver [IN] defines whether this executable should act as a client or a server. server_name [IN] in case of client mode, server_name is the hostname of the server. port [IN] the port on which the server will listen to, the port on which the client will connect to. input_size size of the data vectors that will be sent. output_size size of the data vectors that will be received. |
| See also | amesock_exchange() |
| Returns | SUCCESS if no error occurs. |
| int amesock_close (amesock_conn_attributes * connection) | |
|---|---|
| Initializes the connection attributes with given arguments so that it can be used with amesock_exchange. | |
| Parameters | connection [IN] contains info about the communication. |
| See also | amesock_init() |
| Returns | SUCCESS. |
| int amesock_exchange (amesock_conn_attributes * connection, double * input, double * output) | |
|---|---|
| Exchanges data between the client and the server. | |
| Parameters | connection [IN] contains the info needed by amesock_exchange. input vector that will be sent. Vector size should be the one given to amesock_init. output vector that will be received. Vector size should be the one given to amesock_init. |
| See also | amesock_init() |
| Returns | SUCCESS, CONNECTION_SHUTDOWN if the partner send a tag for communication shutdown. |
Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.lib-cosim/xid1852558 · retrieved 2026-07-17