|
Server Wait On Clients System - API Documentation v1.8.3
Server Wait On Clients System.
|
TCP connection processing functions. More...
#include <errno.h>#include <netdb.h>#include <netinet/in.h>#include <stdio.h>#include <string.h>#include <sys/socket.h>#include <syslog.h>#include <unistd.h>#include <libmgec/libmgec.h>#include <libmgec/mge-errno.h>#include <swoc/libswoccommon.h>
Functions | |
| int | prep_recv_sock (int *sockfd, int *portno) |
| Prepare TCP socket to receive connections. | |
| int | init_conn (int *sockfd, int *portno, const char *srv) |
| Initiate TCP stream socket connection. | |
| int | est_connect (int *sfd, const char *serv, int *portno, struct addrinfo *hints, enum comms_mode *mode) |
| Establish send or receive connection. | |
| int | listen_sock (const int *sfd) |
| Set TCP socket to listen. | |
| int | close_sock (const int *sockfd) |
| Close TCP socket. | |
TCP connection processing functions.
Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0-only
| int close_sock | ( | const int * | sockfd | ) |
Close TCP socket.
Equivalent to close() with error handling. On error mge_errno is set.
| sockfd | The socket file descriptor. |
| int est_connect | ( | int * | sfd, |
| const char * | serv, | ||
| int * | portno, | ||
| struct addrinfo * | hints, | ||
| enum comms_mode * | mode ) |
Establish send or receive connection.
Bind or connect depending on mode - listen or send. On error mge_errno is set.
| sfd | The socket file descriptor. |
| serv | The server name. |
| portno | The port number. |
| hints | The hints for getaddrinfo(). |
| mode | send_mode or recv_mode. |
| int init_conn | ( | int * | sockfd, |
| int * | portno, | ||
| const char * | srv ) |
Initiate TCP stream socket connection.
On error mge_errno is set.
| sockfd | The socket file descriptor. |
| portno | The port number. |
| srv | The server name. |
| int listen_sock | ( | const int * | sfd | ) |
Set TCP socket to listen.
Equivalent to listen() with error handling. A race is possible with other swoc invocations to listen on that socket, so if it is in use do a few retries. On error mge_errno is set.
| sfd | The socket file descriptor. |
| int prep_recv_sock | ( | int * | sockfd, |
| int * | portno ) |
Prepare TCP socket to receive connections.
On error mge_errno is set.
| sockfd | The socket file descriptor. |
| portno | The port number. |