#include "local.h" #include "utils.h" using namespace std; // chat message buffer char message[BUF_SIZE]; // for debug mode int DEBUG_MODE = 0; /* We use 'fork' to make two process. Child process: - waiting for user's input message; - and sending all users messages to parent process through pipe. ('man pipe' has good example how to do it) Parent process: - wating for incoming messages(EPOLLIN): -- from server(socket) to display; -- from child process(pipe) to transmit to server(socket) */ int main(int argc, char *argv[]) { // *** Define debug mode // any additional parameres on startup // i.e. like './client f' or './client debug' // we will switch to debug mode(very simple anmd useful) if(argc > 1) DEBUG_MODE = 1; if(DEBUG_MODE){ printf("Debug mode is ON!\n"); printf("MAIN: argc = %d\n", argc); for(int i=0; i