Simple tools for networking / objects in plain C Snapshot
Functions
ioutils.c File Reference
#include "ioutils.h"
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <unistd.h>
#include <signal.h>

Go to the source code of this file.

Functions

int disable_sigpipe ()
 disable SIG_PIPE signal, checks for static flag so as not to call system call again and again.
int fd_set_blocking (int fd, int is_blocking)
 set mode to blocking / non blocking.
int fd_get_bytes_available (int fd)
 return bytes available for reading
int fd_get_error (int fd)
 return socket error.
int fd_set_buf_size (int fd, Buffsize_op op, int size)
 set receive or send buffer size
int fd_get_buf_size (int fd, Buffsize_op op)
 return the receive or send buffer size
int fd_set_reuse_address (int fd, int reuse_on)
 set reuse address option
int fd_get_reuse_address (int fd)
 get reuse address option
int fd_set_nagling (int fd, int on)
 set naggle algorithm (tcp no delay option)
int fd_set_linger_option (int fd, int on, int linger_value)
 set linger option
int fd_close_by_RST (int fd)
 ungracefull connection termination - send RST to peer;
int fd_make_tcp_listener (SOCKADDR *saddr, int backlog)
 make socket for accepting connections (listening endpoint), with SO_REUSE_ADDRESS and given backlog length.