Sim800 communication concepts/what is the right way to send a tcp massage?

Hey everybody,
So I'm making my own sim800 library (because of reasons) and I'm struggling with some issues:

My controller establishes through a sim800 tcp link with a server, whenever the server wants to send data I receive it by periodically checking modem.available() (modem is a softwareSerial handle).

when sending messages I have a function that sends to the sim800 "AT+CIPSEND" and the data, and waits for a SENDOK message. most of the times everything is fine, but I have this case when the server sends data exactly when between the CIP+SEND and the SENDOK message, so instead of getting SENDOK I receive the message from the server.

does anyone knows how to deal with this?

Thanks in advance!

Bump?