Over TCP communication in C, how can you indicate to stop calling read() for a request without knowing any prior information about the data?
问题 I am currently programming a server in C that communicates over sockets using TCP. The client is supposed to send {filename\n} + {file contents\n} and the server will store that information and then send a response on success. However, we can't be sure the client will actually send the proper information in a structured protocol. Often in simpler situations, we know a specified amount of bytes to be sent before and can wait until that specified number has been reached. In this case, we don't