This commit is contained in:
2026-03-08 13:34:11 -05:00
parent 1368695e74
commit e5bb323a2f
4 changed files with 302 additions and 318 deletions

39
chat.h
View File

@@ -1,46 +1,7 @@
#ifndef CHAT_H
#define CHAT_H
#ifndef _GLIBCXX_STRING
#include <string>
#endif
#ifndef _NETINET_IN_H
#include <netinet/in.h>
#endif
typedef enum {
NO_MODE = 0,
SERVER_MODE = 1,
CLIENT_MODE = 2
} chatmode_t;
typedef struct {
sockaddr_in new_addr;
socklen_t new_addr_siz;
int aux;
}wclient_args_t;
const int CURSOR_DEFAULT_POSITION_X = 2;
const int CURSOR_DEFAULT_POSITION_Y = 12;
const int LOG_LENGTH = 10;
int line_position = 0;
struct timeval time_start;
struct timeval time_end;
int bytes_read;
int bytes_written;
int listen_port = 9999;
std::string listen_ip_address = "127.0.0.1";
std::string log_path;
int socket_descriptor_server;
int socket_descriptor_client;
pthread_t client_wait_thread;
void *await_client(void *a);
void clear_rows(int s, int e);