Well, I'm trying to write my first C application. For now I want to do a primitive chat that allows to save the conversations in a txt file.

The chat will be for POSIX systems and it will use AF_INET / SOCK_STREAM sockets (TCP), it code compiles fine with gcc 4.1.1, the problem comes when I run the program, because the server only receives the first message, after that the client runs out.

The code is very simple but Im unable to find the bug, please try to give me a hand.