fillReadBuffer

Type: Boolean

Set the fillReadBuffer property of the Connection class to true to specify that the readBinary and readBinaryAsynch methods do not return or notify the receiver object until the requested length of the data has been received.

If the fillReadBuffer property is set to false (the default), the readBinary and readBinaryAsynch methods return or notify the receiver object as soon as any data is received for the connection. The length parameter of the readBinary or readBinaryAsynch method is therefore treated as a maximum buffer size.

The following example shows the use of the fillReadBuffer property.

multiReceive();
vars
    bin    : Binary;
    count  : Integer;
    len    : String;
    number : String;
    tcp    : TcpIpConnection;
begin
    // Loop around receiving multiple inputs
    count := 0;
    while true do
        tcp.fillReadBuffer := true;
        bin                := tcp.readBinary(10);
        len                := bin [ 1 : 5 ].String;
        number             := bin [ 6 : 5 ].String;
        bin                := tcp.readBinary(len.Integer);
        sl1.caption        := number & ' ' & bin.String;
        sl1.refreshNow;
        count              := count + 1;
        if number.Integer <= 1 then
            sl1.caption := count.String & $X_Received;
            break;
        endif;
    endwhile;
end;