Send data
Send data to connection
- Parameters
- Advanced call ?
Function SendData(Val Connection, Val Data, Val Timeout = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Connection | - | Arbitrary | ✔ | AddIn object with an open connection or port |
| Data | - | BinaryData | ✔ | Sending data |
| Timeout | - | Number, Undefined | ✖ | Timeout (in ms). No timeout if undefined |
Returns
Map Of KeyAndValue - Processing result
This method has no additional advanced call parameters.
tip
Parameters with Binary data type can also accept file paths on disk and URLs
Caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
// Host
Port = 5555;
ServerObject = OPI_ZeroMQ.BindPortRep(Port);
If Not OPI_ZeroMQ.IsConnectorObject(ServerObject) Then
Raise OPI_Tools.JSONString(ServerObject);
EndIf;
// Client
Address = "tcp://127.0.0.1:5555";
ClientObject = OPI_ZeroMQ.CreateConnectionReq(Address);
If Not OPI_ZeroMQ.IsConnectorObject(ClientObject) Then
Raise OPI_Tools.JSONString(ClientObject);
EndIf;
Message = StrTemplate("ZMQ_SEND_%1", Format(CurrentDate(), "DF=yyyyMMddhhmmss"));
Data = GetBinaryDataFromString(Message);
Result = OPI_ZeroMQ.SendData(ClientObject, Data, 3000);
Result
{
"result": true
}