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 | --conn | Arbitrary | ✔ | AddIn object with an open connection or port |
| Data | --data | BinaryData | ✔ | Sending data |
| Timeout | --tout | Number, Undefined | ✖ | Timeout (in ms). No timeout if undefined |
Returns
Map Of KeyAndValue - Processing result
| Parameter | Description |
|---|---|
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
tip
Parameters with Binary data type can also accept file paths on disk and URLs
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
}