Get next connection data
Gets data from the buffer of the next active connection in the queue where there are incoming data
Function GetNextConnectionData(Val ServerObject, Val Timeout = 1000, Val MaxSize = 8192) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| ServerObject | - | Arbitrary | ✔ | Object of running server component |
| Timeout | - | Number | ✖ | Waiting period for new data if the queue is empty (in ms) |
| MaxSize | - | Number | ✖ | Maximum size of data to receive |
Returns: Map Of KeyAndValue - Execution result
caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
LaunchPort = 9877;
ServerObject = OPI_TCP.StartServer(LaunchPort);
// Send message from client
ConnectionAddress = "127.0.0.1:9877";
ClientObject = OPI_TCP.CreateConnection(ConnectionAddress);
If Not OPI_TCP.IsClientObject(ClientObject) Then
Raise OPI_Tools.JSONString(ClientObject);
Else
Message = "Hello from client!" + Chars.LF;
OPI_TCP.SendLine(ClientObject, Message);
EndIf;
// Receive message on server
Result = OPI_TCP.GetNextConnectionData(ServerObject, 5000, 8192);
Result
{
"active": true,
"address": "127.0.0.1:49390",
"connectionId": "d81c808b-69fb-4b7c-ba11-49f2fa513238",
"message": "<BinaryData>",
"result": true
}