Skip to main content

Create connection (REQ)

Create connection for sending request

Function CreateConnectionReq(Val Address, Val Logging = Undefined) Export

ParameterCLI optionTypeRequiredDescription
Address--addrStringReceiver address
Logging--logStructure Of KeyAndValueLogging settings. See GetLoggingSettings
Returns

Map Of KeyAndValue, Arbitrary - AddIn object or map with error information

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";
Result = OPI_ZeroMQ.CreateConnectionReq(Address);

If Not OPI_ZeroMQ.IsConnectorObject(Result) Then
Raise OPI_Tools.JSONString(Result);
EndIf;

Message = StrTemplate("ZMQ_C_REQ_%1", Format(CurrentDate(), "DF=yyyyMMddhhmmss"));
Data = GetBinaryDataFromString(Message);

Sending = OPI_ZeroMQ.SendData(Result, Data, 3000);
Check = OPI_ZeroMQ.ReceiveData(ServerObject, 3000);
Result
"AddIn.OPI_ZeroMQ.Main"