Function EN Version 4.50

@IPReceive

Internet

Syntax

@IPReceive(SOCKET1;RETTEXT2);
@IPReceive(SOCKET1;RETTEXT2;TIMEOUT3);
@IPReceive(SOCKET1;RETTEXT2;TIMEOUT3;RETTYPETEXT4);

Description

Currently available for Windows only!!!

Receives the TEXT RETTEXT2 via the opened IPSOCKET IPSOCKET1.
The return value of the function is the number of received bytes or an @ERROR-Wert.
The timeout for this function is 10 seconds or FN TIMEOUT3 Sekunden.
Within the function, the availability of new data is checked once per second.
If no data can be received within the timeout, the return value is 0.

Mit dem optionalen Parameter RETTYPETEXT4 the return type of parameter RETTEXT2 festgelegt.
"A" (default) return as TEXT
"RT" return as RICHTEXT (RT)

Example: @IPReceive(SOCKET1;RETTEXT2;TIMEOUT3;RETTYPETEXT4);

IPSOCKET1:=@IPOpenReceiveSocket("";80;"TCP");
IF(@GetDataType(IPSOCKET1)="IPS")
{
   LOOP:=1;
   WHILE(LOOP)
   {
      ConSocket:=@IPWaitForConnection(IPSOCKET1;RETIPHOST2);
      IF(@GetDataType(ConSocket)="IPS")
      {
         DataAvailable:=@IPIsDataAvailable(ConSocket);
         @LogReport(DataAvailable);
         RetSuccess:=@IPReceive(ConSocket;RETTEXT;5;"A");
         ConSocket:=@IPCloseSocket(ConSocket);
      }
      LOOP:=!@TaskShouldStop;
   }
   IPSOCKET1:=@IPCloseSocket(IPSOCKET1);
}

A receiving IPSOCKET is opened and waits for incoming requests
(Until the task is terminated with "Tell engine stop X" or the engine itself is terminated with "Tell engine e".)
When a request is received, the new IPSOCKET ConSocket is checked for available data.
The result of this query is output (variable DataAvailable).
The available data is assigned to the variable RETTEXT is assigned, and the variable RetSuccess is assigned,
either the number of bytes received or, if an error occurs, @ERROR.
The new IPSOCKET ConSocket is also closed again.
When the task is terminated, the receiving IPSOCKET IPSOCKET1 is also closed again.

Note : This text was machine-translated and may contain inaccuracies.