Next: Client connections, Previous: Utility functions, Up: Embedding API [Contents][Index]
This chapter deals with the basic networking and file systems functions. It encapsulates systems calls in a portable manner. These functions should behave identically on Windows and Unices.
Convert ip, an address in network byte order, to its dotted decimal representation, returning a pointer to a statically allocated buffer. (You should copy the result.)
Convert the Internet host address str from the standard
numbers-and-dots notation into binary data and store it in the
structure that addr points to.
Return zero if the address is valid, nonzero otherwise.
As a special case, if str is ‘*’ (asterisk),
store INADDR_ANY
in addr.
Close the socket sock. Return 0 if successful, -1 otherwise.
Set the close-on-exec flag of the given file descriptor fd and return zero on success. Otherwise return non-zero.
Enable or disable the TCP_CORK
socket option of the socket
fd. This is useful for performance reasons when using
sendfile
with any prepending or trailing data not inside the
file to transmit. Return zero on success, otherwise non-zero.
Enable or disable the TCP_NODELAY
setting for the socket
fd depending on the flag set, effectively enabling
or disabling the Nagle algorithm.
This means that packets are always sent
as soon as possible and no unnecessary delays are introduced.
If old is not NULL
, save the old setting there.
Return zero on success, otherwise non-zero.
Transmit data between one file descriptor and another where in_fd is the source and out_fd the destination. The offset argument is a pointer to a variable holding the input file pointer position from which reading starts. On return, the offset variable will be set to the offset of the byte following the last byte that was read. count is the number of bytes to copy. Return the number of bytes actually read/written or -1 on errors.
Open the filename file and convert it into a file handle. The
given flags specify the access mode and the mode argument
the permissions if the O_CREAT
flag is set.
Close the given file handle fd. Return -1 on errors.
Return information about the specified file associated with the file
descriptor fd returned by svz_open
. Store available
information in the stat buffer buf.
Open the file whose name is the string pointed to by file and associate a stream with it.
Dissociate the named stream f from its underlying file.
Next: Client connections, Previous: Utility functions, Up: Embedding API [Contents][Index]