// This is a personal academic project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com #include "include/client.h" int main(int argc, char *argv[]) { int fd = createSocket(); struct sockaddr_in serv_addr; setSockAddress(argc, argv, &serv_addr); connectToSocket(fd, &serv_addr); processAndSendInput(fd); closeSocket(fd); return EXIT_SUCCESS; } void processAndSendInput(int fd) { char input[MAX_LEN] = {0}; int readChars; while ((readChars = read(STDIN_FILENO, input, MAX_LEN - 1)) != 0) { if (readChars < 0) printSystemError("User: read()"); input[readChars] = '\0'; if (write(fd, input, readChars) < 0) printSystemError("User: write()"); } }