PDA

View Full Version : Determining TWinSocketStream max read speed



cronodragon
20-11-2006, 02:25 PM
According to Delphi's help:


Read may return 0 if the socket connection is extremely slow and the read operation has not completed after TimeOut milliseconds. This ensures that the Read method does not hang indefinitely when a problem occurs with the socket connection.

To guard against the Read method timing out because of a slow connection, set Count fairly low, and make several calls to Read, rather than fewer calls with a large value of Count.

Is there a way to determine the best value for Count? I'm thinking on making an algorithm that increases the Count value until a relevant slow down is detected.

JSoftware
20-11-2006, 11:27 PM
I always use 256 but I haven't looked into or benchmarked speed :?