I seem to have this one backwards.
The socket.id must be something other than -1.
If the socket.id is -1, then just return F_file_descriptor without error bit to designate that no descriptor is available to connect with.
#ifndef _di_f_socket_connect_
f_status_t f_socket_connect(const f_socket_t socket) {
- if (socket.id != -1) return F_file_descriptor;
+ if (socket.id == -1) return F_file_descriptor;
if (connect(socket.id, (struct sockaddr *) &socket.address, socket.length) == -1) {
if (errno == EACCES) return F_status_set_error(F_access_denied);
/**
* Connect to a socket.
*
+ * This connects the socket against socket.id.
+ * Check the individual read/write socket functions to confirm or deny whether or not this socket.id or socket.id_data is to be used.
+ *
* @param socket
* The socket structure.
* The socket.address may point to any valid structure, like "struct sockaddr", "struct sockaddr_un", or "struct sockaddr_in".
+ * Only socket.id is used.
*
* @return
* F_okay on success.
- * F_file_descriptor if socket file descriptor is already connected (socket.id != -1).
+ * F_file_descriptor if socket file descriptor is not valid (socket.id == -1).
*
* F_access_denied (with error bit) on access denied.
* F_available_not_address (with error bit) if address is unavailable (is non-existent or not local).