Molssi Driver Interface Library: /repo/build/MDI_Library/MDI_Library/mdi_tcp.h File Reference

|  | Molssi Driver Interface Library

Functions
mdi_tcp.h File Reference

TCP communication implementation. More...

`#include "mdi.h"`
`#include "mdi_global.h"`

Go to the source code of this file.

## 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...

## Detailed Description

TCP communication implementation.

## Function Documentation

## ◆ sigint_handler()

void sigint_handler | ( | int | dummy | ) |

SIGINT handler to ensure the socket is closed on termination.

Parameters

  [in] | dummy | Dummy argument.

## ◆ tcp_listen()

int tcp_listen | ( | int | port_in | ) |

Begin listening for incoming TCP connections.

Parameters

  [in] | port | Port to listen over

## ◆ tcp_recv()

int tcp_recv | ( | void * | buf,
|  | int | count,
|  | MDI_Datatype | datatype,
|  | MDI_Comm | comm,
|  | int | msg_flag
| ) |  |

Receive data through an MDI connection, using TCP.

Parameters

  [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.

## ◆ tcp_request_connection()

int tcp_request_connection | ( | int | port_in,
|  | char * | hostname_ptr
| ) |  |

Request a connection over TCP.

Parameters

  [in] | port | Port over which the driver is listening
  [in] | hostname_ptr | Hostname of the driver

## ◆ tcp_send()

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.

Parameters

  [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.