TCP socket in Unix - notify server I am done sending

前端 未结 2 842
醉酒成梦
醉酒成梦 2021-01-14 15:52

I have a tiny little TCP app where many clients connect to a server, send data to it (via write() - they are also sending message size) and then exit. I have the clients sen

2条回答
  •  萌比男神i
    2021-01-14 16:11

    This is done at the application level. In HTTP it is done by closing the socket for a response. Also in HTTP after the server receives two returns, it knows the GET request has finished sending then if there is a content-length header, it knows that the client/server is finished sending after X bytes.

    You will need to implement something similar.

提交回复
热议问题