Receive data
Receive next message from connection
- Parameters
- Advanced call ?
Function ReceiveData(Val Connection, Val Timeout) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Connection | --conn | Arbitrary | ✔ | AddIn object with an open connection or port |
| 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) |
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_RECV_%1", Format(CurrentDate(), "DF=yyyyMMddhhmmss"));
Data = GetBinaryDataFromString(Message);
Result = OPI_ZeroMQ.ReceiveData(ServerObject, 3000);
Result
{
"data": "<BinaryData>",
"result": true,
"size": 23
}