int gest_socket () { int bytes_read = 1; while (bytes_read != 0) { if ((bytes_read = read(sock, buffer, LG_BUFFER)) == 0) exit(EXIT_FAILURE); if (bytes_read < 0) { perror("read"); exit(EXIT_FAILURE); } write(STDOUT_FILENO, buffer, bytes_read); } return (bytes_read); }