Re: Functions in socket



nick048 wrote:
Now, I need to pass from a client (example telnet) a phrase
(multiline) terminated by "..".
[...]
if ((fd = accept(sock, (struct sockaddr *)&client, &client_len)) < 0)
[...]
receive_phrase(fd, fd);
close(fd);
[...]
Can You suggest me how create the function receive_phrase terminated
with "..".

Tough. I can't imagine a function that requires passing the same argument
twice. ;)

Anyhow, let's sum up what you need:
1. A way to signal errors like e.g. a broken connection or allocation
failure.
2. A way to pass out arbitrary amounts of dynamically allocated data and
their length.

If you have that, the rest is just implementing it.

BTW: read the FAQ about homework.

Uli

.