Hi to All,
I have written a little server that work fine.
Now I need to add a function in the main that process a phrase, passed from a client as telnet. The last part of main is:
fd is the socket descriptor and the function is like:Code:listen(sock, 1);/* connection client */while (1) {client_len = sizeof(client);if ((fd = accept(sock, (struct sockaddr *)&client, &client_len)) < 0) {perror("accepting connection");exit(3);}fprintf(stderr, "The connection is Open.\n");send(fd, "Wellcome in my Server !\n\n", 38, 0);send(fd, "Please send Your Phrase, terminated by ..)!\n\n", 44, 0);process_phase(fd,fd);close(fd);fprintf(stderr, "The Connection is Closed.\n");}
void process_phrase(int in, int out);
How must write the code that read the phrase until the client send the terminator signal ".."
I hope in Your help. I am a newbie in C programming.
Thank You and Best Regards.
Nick