another question about TCP

In my system,the HMI is made by JAVA and my sample process is writen by C,I want to send data from C pro to JAVA,I use TCP to transfer data between them,the C pro is looked as server and JAVA pro is looked as client,I use “127.0.0.1” as the ip that client connects to server,they works well,but there’s one problem,when the server accepts successfully and go to prepare to receive data,it is very strange that it begins to receive a lots of data (for recv()!=-1) and can not stop,but the JAVA doesn’t send any data to server,I want to know where does the data come from?

the reason is for client side uses close() to close the socket,that result to server side recv() can’t be stopped,how to solve it?

when you call close() on client side, then on server you will eventually get len=recv() where len==0 as indication for the server that client closed its part of the connection

thanks,I have found it.