Gromacs  2021-beta2-UNCHECKED
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions | Variables
imdsocket.cpp File Reference
#include "gmxpre.h"
#include "imdsocket.h"
#include "config.h"
#include <cerrno>
#include <cstring>
#include <ctime>
#include "gromacs/imd/imd.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
+ Include dependency graph for imdsocket.cpp:


Implements functions of imdsocket.h.

This file re-implements vmdsock.c functions from original IMD API from scratch, see imdsocket.h for references to the IMD API.

Martin Hoefling, Carsten Kutzner


struct  gmx::IMDSocket
 IMD (interactive molecular dynamics) socket structure. More...


#define ERR_ARGS   __FILE__, __LINE__, strerror(errno)
 Simple error handling.


int gmx::imdsock_winsockinit ()
 Define a function to initialize winsock. More...
static void gmx::print_IMD_error (const char *file, int line, char *msg)
 Print a nice error message on UNIX systems, using errno.h.
IMDSocket * gmx::imdsock_create ()
 Create an IMD master socket. More...
void gmx::imd_sleep (unsigned int seconds)
 Portability wrapper around sleep function.
int gmx::imdsock_bind (IMDSocket *sock, int port)
 Bind the IMD socket to address and port. More...
int gmx::imd_sock_listen (IMDSocket *sock)
 Set socket to listening state. More...
IMDSocket * gmx::imdsock_accept (IMDSocket *sock)
 Accept incoming connection and redirect to client socket. More...
int gmx::imdsock_getport (IMDSocket *sock, int *port)
 Get the port number used for IMD connection. More...
int gmx::imd_htonl (int src)
 Portability wrapper around system htonl function.
int gmx::imd_ntohl (int src)
 Portability wrapper around system ntohl function.
int gmx::imdsock_write (IMDSocket *sock, const char *buffer, int length)
 Write to socket. More...
int gmx::imdsock_read (IMDSocket *sock, char *buffer, int length)
 Read from socket. More...
void gmx::imdsock_shutdown (IMDSocket *sock)
 Shutdown the socket. More...
int gmx::imdsock_destroy (IMDSocket *sock)
 Close the socket and free the sock struct memory. More...
int gmx::imdsock_tryread (IMDSocket *sock, int timeoutsec, int timeoutusec)
 Try to read from the socket. More...


constexpr int gmx::c_maxConnections = 1
 Currently only 1 client connection is supported.