make
- normal build or build files which changed
make
- normal full build
make debug
- debug build files which changed
make rebug
- debug build ALL files (similiar to make re)
Prototype
How we use the fnct
@brief
@note
@param
@return
int socket(int domain, int type, int protocol);
socket(AF_INET, SOCK_STREAM, 0)
@brief Create a TCP socket
@note A stream socket must be in a "connected" state before any data may be sent or received on it. syscall man (2)
@param AF_INET, ipv4 protocol
@param SOCK_STREAM, TCP as transport layer
@param 0, protocol for SOCK_STREAM which TCP
@return On success, a file descriptor for the new socket is returned. On error, -1 is returned, and errno is set to indicate the error.
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
bind(server_fd, (struct sockaddr *)&address, sizeof(address))
@brief Bind a socket (file-descriptor) to a Network-Interface:Port
@note When a socket is created with socket, it exists in a name space (address family) but has no address assigned to it. bind assigns the address specified by addr to the socket referred to by the file descriptor sockfd. syscall man (2)
@param server_fd, file descriptor returned by socket()
@param address, struct sockaddr_in address;
contains network parameters address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY; address.sin_port = htons( PORT );
@param sizeof(address), len of the network addr param
@return On success, zero is returned. On error, -1 is returned, and errno is set to indicate the error.
int listen(int sockfd, int backlog);
listen(server_fd, 10)
@brief Listen for connections on a socket
@note will be used to accept incoming connection requests using accept. syscall man (2)
@param server_fd filedescriptor of the socket previously created.
@param server_fd maximum length to which the queue of pending connections for the provided socket filedescriptor may grow. If full, the client may get an error except if the underlying protocol support retransmission.
@return On success, zero is returned. On error, -1 is returned, and errno is set to indicate the error.
int accept(int sockfd, struct sockaddr *restrict addr, socklen_t *restrict addrlen);
accept(server_fd, (struct sockaddr )&address, (socklen_t)&addrlen)
@brief Accept a connection on a socket
@note Extracts the first connection request on the queue of pending connections for the listening socket, returns a new file descriptor referring to a new socket. New socket not listening, origin not affected. syscall man (2)
@param server_fd filedescriptor of the socket previously created.
@param (struct sockaddr )&address Pointer to the struct containing network parameters previously created.
@param (socklen_t)&addrlen) len of the struct.
@return On success, return a file descriptor for the accepted socket (a nonnegative integer). On error, -1 is returned, errno is set to indicate the error
int poll(struct pollfd *fds, nfds_t nfds, int timeout);
@brief Waits for one of a set of file descriptors to become ready to perform I/O.
@note Use an array of struct of type pollfd {int fd; short events; short revents; };
@param *fds Array of struct pollfd.
@param nfds number of items in the fds array.
@param timeout len of the struct.
@return number of milliseconds that poll() should block waiting for a file descriptor to become ready