I have a project in which I have to write a client program for the finger protocol.
It's a very, very basic program which covers the basic socket() connect()
connectToHost() and read()/write() functions. I am having a small problem which
I cannot figure out. My program compiles perfectly, no errors, but there is no output
after I read in from the server. My write statements look something like:

ToServer = argv[k];
write(socketNo, ToServer, bufferSize);
write(socketNo, "\n", bufferSize;

and then my read statements, which i think are where the problem is occuring:

n = read(socketNo, FromServer, bufferSize);
while (n != 0)
   n = read(socketNo, FromServer, bufferSize);
   cout << FromServer << endl;

Please help, thanks in advance

This article has been dead for over six months. Start a new discussion instead.