43 remove_fd_from_queue(server, fd);
52 bool is_found =
false;
61 if (is_found ==
false) {
74 strlen(buffer) - 1) == 0 &&
85 remove_fd_from_queue(server, fd);
92 const char buffer[
MAX_BUFFER_SIZE],
const bool is_in_queue,
const int idx)
94 if (is_in_queue ==
true) {
96 set_gui_client(server, idx);
99 if (search_team_name(server, buffer) == 0) {
100 set_ai_client(server, buffer, idx);
111 ssize_t read_bytes = 0;
113 bool is_in_queue =
false;
116 idx = search_in_queue(server, fd);
122 read_bytes = read(fd, buffer,
sizeof(buffer));
123 if (read_bytes <= 0) {
126 printf(
"The client %d has been deconnected.\n", fd);
129 launch_command(server, buffer, is_in_queue, idx);
int delete_client(cli_t client[MAX_CLIENT], const int fd)
The function to delete a specific client from the cli_t structure by the fd.
int get_client(cli_t client[MAX_CLIENT], const int fd)
The function to get the client index in the structure by the fd.
void command_handling(server_handler_t *server, const int fd)
Handle client message/command.
cli_t clients[MAX_CLIENT]
A structure to store server general data.
int write_to_client(const int fd, const char *str)
Write any message to a specific file descriptor.