Next: , Up: Client connections   [Contents][Index]


5.2.7.1 TCP sockets

TCP sockets provide a reliable, stream oriented, full duplex connection between two sockets on top of the Internet Protocol (IP). TCP guarantees that the data arrives in order and retransmits lost packets. It generates and checks a per packet checksum to catch transmission errors. TCP does not preserve record boundaries.

Function: svz_socket_t * svz_tcp_connect (svz_address_t *host, in_port_t port)

Create a TCP connection to host host and set the socket descriptor in structure sock to the resulting socket. Return NULL on errors.

Function: int svz_tcp_read_socket (svz_socket_t *sock)

Read all data from sock and call the check_request function for the socket, if set. Return -1 if the socket has died, zero otherwise.

This is the default function for reading from sock.

Function: int svz_tcp_send_oob (svz_socket_t *sock)

If the underlying operating system supports urgent data (out-of-band) in TCP streams, try to send the byte in sock->oob through the socket structure sock as out-of-band data. Return zero on success and -1 otherwise (also if urgent data is not supported).