MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
sockio.h File Reference

Data Structures

struct  udp_t

Functions

ssize_t wrap_io (int sfd, void *p, const size_t len, int mode)
int stwrite (int sfd, const void *p, size_t len)
int stread (int sfd, void *p, size_t len)
int stwritestr (int sfd, const char *str)
int streadstr (int sfd, char **str)
int stwritestrarr (int sfd, const char *const *str, int nstr)
int streadstrarr (int sfd, char ***str, int *nstr)
int stwritefd (int sfd, int fd)
int streadfd (int sfd, int *fd)
int stcheck (int sfd)
int udp_send (udp_t *info, char *buf, size_t len, int counter)
int udp_recv (udp_t *info, char **pbuf, size_t *len)

Detailed Description

Routines handle socket i/o.


Data Structure Documentation

◆ udp_t

struct udp_t
Collaboration diagram for udp_t:
Data Fields
struct sockaddr_in peer_addr
int sock
int version
int payload
int header

Function Documentation

◆ stwritestr()

int stwritestr ( int sfd,
const char * str )

Write a string to socket

◆ streadstr()

int streadstr ( int sfd,
char ** str )

Read a string from socket

◆ stwritestrarr()

int stwritestrarr ( int sfd,
const char *const * str,
int nstr )

Write a string array to socket

◆ streadstrarr()

int streadstrarr ( int sfd,
char *** str,
int * nstr )

Read a string array from socket

◆ stwritefd()

int stwritefd ( int sfd,
int fd )

Wrie a file descriptor to socket. Transfer a open file (socket) descriptor to another process in the same hosts. sfd has to be a AF_UNIX socket.

◆ streadfd()

int streadfd ( int sfd,
int * fd )

Read a file descriptor from socket. Use with stwritefd();

◆ udp_send()

int udp_send ( udp_t * info,
char * buf,
size_t len,
int counter )

Use UDP socket to send data reliably. Status is checked.

◆ udp_recv()

int udp_recv ( udp_t * info,
char ** pbuf,
size_t * len )

Use UDP socket to receive data reliably. if counter