delphi - Why is it not safe to use Socket.ReceiveLength? -


OK, also states that the socket buffer is not guaranteed to return the exact result of the bytes ready for reading , But if you take 1 in the socket, you see it. Receivebuf (What is it that wrapes the receiver lamps) This is Iioctlsocket to determine the amount of data with FIONREAD in the network input buffer which is pending Socket S can be read from.

So, how is it safe or not bad?

Example: ioctlsocket (socket.Socket Handle, FistRed, Longgunt (I));

The document you refer to is specifically called (emphasis my Note: Receive lineline is not guaranteed to be accurate for streaming socket connection

This means that the length time I do not know before because it is being supplied with a stream of data, obviously, if you do not know how big the data is being sent before time, then you Can not set the client's expectations properly.

To copy this file, consider it like a normal code. If you do not know ahead of time how many files you copy, you can not predict how many bytes you will copy. In the case of socket, the stream size supplying the socket is not known in advance (for example, the data is being sent in real time and time), so there is no way to indicate how much the client socket is to expect. . / P>

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -