The server is debian-jessi.
We can easily get connected to our server it is fine but when we send message such as"hello world" or MQTT connection package over TCP, the connection establishes but connection turns off 5 seconds later. The connection between server and device gets disconnected, message we receive “CLOSED” .
In my experience, TCP connection on SIM800 is very unstable. You should try avoiding the use of delay() between commands. Try to capture and interpret the response of the module after each command and immediately send the next command, as the TCP connection seems to be very time sensitive (and generally inpatient). The module is already very slow, so adding delays might be worsening the situation.
Also, if you can avoid using TCP and switch to HTTP, the interface in the SIM800 is much better, as it lets you prepare all the data and send it in one go (thus avoiding those pesky time constraints).