server03 started
This commit is contained in:
42
server03.h
Normal file
42
server03.h
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Created by Ajurna on 29/07/2025.
|
||||
//
|
||||
|
||||
#ifndef SERVER03_H
|
||||
#define SERVER03_H
|
||||
|
||||
|
||||
#endif //SERVER03_H
|
||||
#pragma once
|
||||
#include <winsock2.h>
|
||||
|
||||
typedef struct ClientConnection {
|
||||
SOCKET client;
|
||||
char *username;
|
||||
} client_connection_t;
|
||||
|
||||
typedef struct Connections {
|
||||
size_t size;
|
||||
size_t len;
|
||||
client_connection_t *clients;
|
||||
} connections_t;
|
||||
|
||||
typedef struct handleArgs {
|
||||
int connection;
|
||||
SOCKET client;
|
||||
connections_t connections;
|
||||
} handle_args_t;
|
||||
|
||||
|
||||
|
||||
void *handle_connection(void *args);
|
||||
|
||||
connections_t *connections_create(int size);
|
||||
void connections_destroy(connections_t *connections);
|
||||
void connections_append(connections_t *connections, SOCKET client, char *username);
|
||||
void connections_remove(connections_t *connections, SOCKET client);
|
||||
|
||||
char *trim(char *str);
|
||||
bool username_is_valid(const char *username);
|
||||
|
||||
void broadcast(const connections_t *connections, const SOCKET *source, const char *message);
|
||||
Reference in New Issue
Block a user