Simple tools for networking / objects in plain C Snapshot
Classes | Defines | Typedefs | Functions
sock.h File Reference

Go to the source code of this file.

Classes

struct  tagSOCKCTX

Defines

#define LINGER_OPTION_VALUE   300
#define SOCKCTX_FLAGS_NAGLE_ON   2
#define SOCKTCX_FLAGS_DONT_CLOSE_ON_PEER_CLOSE   4

Typedefs

typedef struct tagSOCKCTX SOCKCTX

Functions

int SOCK_init (SOCKCTX *ctx, int verbose, int flags)
 creates a socket and sets some options
int SOCK_attach (SOCKCTX *ctx, int fd, int verbose, int flags)
int SOCK_send_buffer_sizes (SOCKCTX *ctx, int read_buffer_size, int write_buffer_size)
 set read and write buffer sizes; a value of -1 for buffer size is ignored.
int SOCK_connect (SOCKCTX *ctx, void *addr, int addr_size, int connect_timeout)
 connects a sockets with timeout (in seconds)
int SOCK_recv (SOCKCTX *ctx, void *msg, size_t length, int read_timeout)
 read some data from a socket with timeout (in seconds)
int SOCK_recv_all (SOCKCTX *ctx, void *msg, size_t length, int read_timeout)
 read whe whole buffer from a socket with timeout (in seconds)
int SOCK_send (SOCKCTX *ctx, void *msg, size_t length, int write_timeout)
 write whe whole buffer from a socket with timeout (in seconds)
int SOCK_close (SOCKCTX *ctx)
 close the
int SOCK_close_with_reset (SOCKCTX *ctx)
 ungraceful connection termination.