Molssi Driver Interface Library
|
TCP communication implementation. More...
#include <netinet/in.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include "mdi.h"
#include "mdi_tcp.h"
#include "mdi_global.h"
Functions | |
void | sigint_handler (int dummy) |
SIGINT handler to ensure the socket is closed on termination. More... | |
int | enable_tcp_support (int code_id) |
Enable support for the TCP method. | |
int | tcp_on_selection () |
Callback when the end-user selects TCP as the method. | |
int | tcp_on_accept_communicator () |
Callback when the TCP method must accept a communicator. | |
int | tcp_on_send_command (const char *command, MDI_Comm comm, int *skip_flag) |
Callback when the TCP method must send a command. | |
int | tcp_after_send_command (const char *command, MDI_Comm comm) |
Callback after the TCP method has received a command. | |
int | tcp_on_recv_command (MDI_Comm comm) |
Callback when the TCP method must receive a command. | |
int | tcp_listen (int port_in) |
Begin listening for incoming TCP connections. More... | |
int | tcp_request_connection (int port_in, char *hostname_ptr) |
Request a connection over TCP. More... | |
int | tcp_accept_connection () |
Accept a TCP connection request. | |
int | tcp_send (const void *buf, int count, MDI_Datatype datatype, MDI_Comm comm, int msg_flag) |
Send data through an MDI connection, using TCP. More... | |
int | tcp_recv (void *buf, int count, MDI_Datatype datatype, MDI_Comm comm, int msg_flag) |
Receive data through an MDI connection, using TCP. More... | |
TCP communication implementation.
void sigint_handler | ( | int | dummy | ) |
SIGINT handler to ensure the socket is closed on termination.
[in] | dummy | Dummy argument. |
int tcp_listen | ( | int | port_in | ) |
Begin listening for incoming TCP connections.
[in] | port | Port to listen over |
int tcp_recv | ( | void * | buf, |
int | count, | ||
MDI_Datatype | datatype, | ||
MDI_Comm | comm, | ||
int | msg_flag | ||
) |
Receive data through an MDI connection, using TCP.
[in] | buf | Pointer to the buffer where the received data will be stored. |
[in] | count | Number of values (integers, double precision floats, characters, etc.) to be received. |
[in] | datatype | MDI handle (MDI_INT, MDI_DOUBLE, MDI_CHAR, etc.) corresponding to the type of data to be received. |
[in] | comm | MDI communicator associated with the connection to the sending code. |
[in] | msg_flag | Type of role this data has within a message. 0: Not part of a message. 1: The header of a message. 2: The body (data) of a message. |
int tcp_request_connection | ( | int | port_in, |
char * | hostname_ptr | ||
) |
Request a connection over TCP.
[in] | port | Port over which the driver is listening |
[in] | hostname_ptr | Hostname of the driver |
int tcp_send | ( | const void * | buf, |
int | count, | ||
MDI_Datatype | datatype, | ||
MDI_Comm | comm, | ||
int | msg_flag | ||
) |
Send data through an MDI connection, using TCP.
[in] | buf | Pointer to the data to be sent. |
[in] | count | Number of values (integers, double precision floats, characters, etc.) to be sent. |
[in] | datatype | MDI handle (MDI_INT, MDI_DOUBLE, MDI_CHAR, etc.) corresponding to the type of data to be sent. |
[in] | comm | MDI communicator associated with the intended recipient code. |
[in] | msg_flag | Type of role this data has within a message. 0: Not part of a message. 1: The header of a message. 2: The body (data) of a message. |