TCP client on nodemcu[ESP8266 Lolin v0.1]

TCP client in nodemcu esp8266. TCP server is running in Hercules windows application. Client to server communication is faster but server to client is not faster. It is taking around 5 seconds to receive messages sent from server. Why it is like that?

I have attached code also for reference.

Please someone help me on this

TcpClient3.ino (1.97 KB)

and the implementation on server is yours?

No. Server is running on Windows application called Hercules.

If I create client using putty then everything is working fine. Message transmission from server to client and vice versa is faster. Only in NodeMCU it is like that. Reception from server takes time.

Is there any mistakes in code?