liblightify
socket.c File Reference
#include "liblightify-private.h"
#include "socket.h"
#include "context.h"
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for socket.c:

Go to the source code of this file.

Functions

int write_to_socket (struct lightify_ctx *ctx, unsigned char *msg, size_t size)
 
int read_from_socket (struct lightify_ctx *ctx, unsigned char *msg, size_t size)
 
LIGHTIFY_EXPORT int lightify_skt_setfd (struct lightify_ctx *ctx, int socket)
 
LIGHTIFY_EXPORT int lightify_skt_getfd (struct lightify_ctx *ctx)
 
LIGHTIFY_EXPORT int lightify_skt_setiotimeout (struct lightify_ctx *ctx, struct timeval tv)
 
LIGHTIFY_EXPORT struct timeval lightify_skt_getiotimeout (struct lightify_ctx *ctx)
 

Function Documentation

§ read_from_socket()

int read_from_socket ( struct lightify_ctx ctx,
unsigned char *  msg,
size_t  size 
)

Read from socket, handling async I/O and co

Parameters
ctxlibrary context
msgwhere to store the result
sizeexpected read, also buffer size of msg.
Returns
actual read bytes, <0 on errors

Definition at line 121 of file socket.c.

§ write_to_socket()

int write_to_socket ( struct lightify_ctx ctx,
unsigned char *  msg,
size_t  size 
)

Write msg to socket; handling async IO and co

Parameters
ctxlibrary context
msgwhat to write
sizehow many bytes to be written
Returns
negative: error, positive: number of bytes written.

Definition at line 45 of file socket.c.