The time has come for the seventh lecture of the course “Network Programming in UNIX”, prepared by SkyDNS and Aydeko . Course author Alexander Patrakov explains to students how to speed up the reading of small portions of data from a socket.
In the fourth lecture, Alexander told what to do if the recv () function returns less bytes than it was asked for (in conditions where it is known how many bytes need to be read). Cases when it is necessary to read before the delimiter (this is the case in protocols like http) were considered in passing. ')
“In the fourth lecture, the simplest version of the solution to the reading problem before the delimiter was proposed - to read one byte per cycle. This leads to unnecessary CPU time, ”explains Alexander Patrakov.
Want to know how to avoid irrational reading on one byte? Watch the lecture!