How can I tell when recv is finished with pending data?

I'm working with recv and I am having a heck of a lot of trouble ignoring excess data that I did not ask for. I was hoping someone could shine some light on the subject for me because I'm not getting anywhere fast.

---------- Post updated at 02:46 AM ---------- Previous update was at 12:31 AM ----------

Ok wow I was already given this answer I just didn't understand it. this is solved.
Sorry about this post.

---------- Post updated at 02:47 AM ---------- Previous update was at 02:46 AM ----------

When recv() is finished with a single send it null terminates with '\n'

Read one character at a time into a larger buffer than you need.

Stop when you receive \n. That's when you know it's done.

Copy into the actual buffer, up to the the end of what you actually wanted. This ignores any you didn't need.

Thanks!