Header file for socket server functions. More...
Go to the source code of this file.
Functions | |
struct sockaddr_in | create_address (int port) |
Creates a sockaddr_in structure for the given port. | |
int | create_socket_server (int port) |
Creates a socket server and binds it to the specified port. | |
int | listen_socket (int sock) |
Listens for incoming connections on the specified socket. | |
Header file for socket server functions.
This file contains the declarations of functions used to create and manage a socket server.
struct sockaddr_in create_address | ( | int | port | ) |
Creates a sockaddr_in structure for the given port.
This function initializes a sockaddr_in structure with the specified port and sets the address to INADDR_ANY.
port | The port number to bind the address to. |
int create_socket_server | ( | int | port | ) |
Creates a socket server and binds it to the specified port.
This function creates a socket, binds it to the given port, and sets it up to listen for incoming connections.
port | The port number to bind the socket to. |
int listen_socket | ( | int | sock | ) |
Listens for incoming connections on the specified socket.
This function sets the socket to listen for incoming connections.
sock | The file descriptor of the socket to listen on. |