Function EN Version 4.60

@IPOpenReceiveSocket

Internet

Syntax

@IPOpenReceiveSocket(SERVER1;PORT2;PROTOCOL3);

Description

Currently available for Windows only!!!

Opens a communication endpoint (port) for incoming IP connections on the server name TEXT SERVER1, unter dem FN PORT2 und dem Protokoll TEXT PROCOTCOL3 und gibt einen IPSOCKET. The first parameter can also be empty if only one IP address has been assigned on the executing machine. For multi-homed hosts, however, the correct IP address or the name registered in DNS must be used. After this function has been called successfully, UDP clients can use this port immediately and send data to it. With TCP, a @IPWaitForConnection must be called first.

PROTOCOL3:
UDP      UDP connection (datagrams, connectionless, broadcast-capable, delivery not guaranteed)
TCP      TCP-Verbindung (Stream-Daten, verbindungsorientiert)

Example: @IPOpenReceiveSocket(SERVER1;PORT2;PROTOCOL3);

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);
         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 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.