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

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

Read from socket, handling async I/O and co

Parameters

  ctx | library context
  msg | where to store the result
  size | expected read, also buffer size of msg.

Returns
  actual read bytes, <0 on errors

Definition at line 121 of file socket.c.

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

Write msg to socket; handling async IO and co

Parameters

  ctx | library context
  msg | what to write
  size | how many bytes to be written

Returns
  negative: error, positive: number of bytes written.

Definition at line 45 of file socket.c.