TCP Programming problems with recv

This is a discussion on TCP Programming problems with recv within the C++ Programming forums, part of the General Programming Boards category; Hey,
I am learning how to program a TCP server and have a problem.
I get everything up and running ...

TCP Programming problems with recv

Hey,

I am learning how to program a TCP server and have a problem.

I get everything up and running and I can connect to the server and the server can send information out to the client fine.

The problem I have now though is that I'd like to know how to tell the server to prompt the user to enter information (aka commands). I have tried the recv(socket, buffer, bufferlength, flags) approach but I think I don't know the right flags (I'm trying '0')to use because I can only recieve one letter, after that theres a big string of symbols.

Any help as to how I can get strings and no jibberish would be most appreciated, as always.

sprintf(ClientOutput,"Please type something: ");
send(SOCKET,ClientOutput,strlen(ClientOutput),0);
char ClientInput[1000];
recv(SOCKET1,ClientInput,1000,2); // Get stuff by the client
cout << ClientInput; // Output it to the server
send(SOCKET1,ClientInput,strlen(ClientInput),0); // Output it back to the client
Sleep(3000);
closesocket(SOCKET1);

When the user types something it is supposed to echo it back to them. But It only lets them type one character. It then has that character as the first character of the string and then adds about 7-10 other symbols to the end of that string.