1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-07 07:10:01 +02:00
OpenIntegrations/docs/en/examples/TCP/WaitIncomingConnections.txt
Vitaly the Alpaca (bot) c6f5571c89 Main build (Jenkins)
2025-01-23 12:10:45 +03:00

35 lines
1.0 KiB
Plaintext
Vendored

// -- Test request for server
ClientKey = New UUID;
Message = "Test data sending to the server";
ClientParams = New Array;
ClientParams.Add("127.0.0.1:7788"); // Our server
ClientParams.Add(Message); // Test string
ClientParams.Add("UTF-8"); // Encoding
ClientParams.Add("20000"); // Timeout, for make it in time launch server
// Sending a test request via TCP client methods
ClientBackground = BackgroundJobs.Execute("OPI_TCP.SendLine", ClientParams, ClientKey);
// --
TCPServer = OPI_TCP.CreateServer(7788, True);
NewConnection = OPI_TCP.WaitIncomingConnections(TCPServer, 20);
If NewConnection["result"] Then
Connection = NewConnection["connection"]["id"];
ProcessingParameterArray = New Array;
ProcessingParameterArray.Add(Connection); // String: "1:7788"
BackgroundProcessing = BackgroundJobs.Execute("OPI_Tests.TCP_ProcessConnection", ProcessingParameterArray);
TCP_ProcessConnection(Connection);
EndIf;
Shutdown = OPI_TCP.StopServer(TCPServer);