writeBinary(buffer: Binary);
The writeBinary method of the Connection class writes binary data to the connection and returns when the operation is complete. The writeBinary method can be called only when the value of the state property is Connected (2).
The following example shows the use of the writeBinary method.
openButton_click(btn: Button input) updating;
vars
pos : Integer;
bin : Binary;
begin
if openButton.caption = $X_Open then
self.connection.name := connectionName.text;
self.connection.open;
openButton.caption := $X_OK;
listenButton.caption := $X_Close;
else
if sendIt.value then
if loop.value then
self.multiSend;
else
self.connection.writeBinary(input.text.Binary);
endif;
elseif receiveIt.value then
if loop.value then
self.multiReceive;
else
self.connection.fillReadBuffer := false;
bin := self.connection.readBinary(200);
sl1.caption := bin.String;
endif;
endif;
endif;
end;
See also the Connection class timeout property.