Claude Chappe' Curse - A C Game
Logo Institut d'Informatique Claude Chappe Logo Université de Le Mans Logo Raeptor Production
 
Loading...
Searching...
No Matches
server.h File Reference

Header file for socket server functions. More...

This graph shows which files directly or indirectly include this file:

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.
 

Detailed Description

Header file for socket server functions.

This file contains the declarations of functions used to create and manage a socket server.

Function Documentation

◆ create_address()

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.

Parameters
portThe port number to bind the address to.
Returns
A sockaddr_in structure initialized with the given port.

◆ create_socket_server()

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.

Parameters
portThe port number to bind the socket to.
Returns
The file descriptor of the created socket, or -1 on error.

◆ listen_socket()

int listen_socket ( int  sock)

Listens for incoming connections on the specified socket.

This function sets the socket to listen for incoming connections.

Parameters
sockThe file descriptor of the socket to listen on.
Returns
0 on success, or -1 on error.