@IPWaitForConnection
Syntax
@IPWaitForConnection(IPSOCKET1;RETIPHOST2);
@IPWaitForConnection(IPSOCKET1;RETIPHOST2;TIMEOUT3);
Description
Currently available for Windows only!!!
Waits for an incoming TCP/IP connection to be opened on IPSOCKET IPSOCKET1 and otherwise returns from the call only after FN TIMEOUT3 or 10 seconds.
After that, data can be exchanged connection-oriented using @IPSend and @IPReceive.
The IP address of the incoming host is returned in TEXT RETIPHOST2.
Example: @IPWaitForConnection(IPSOCKET1;RETIPHOST2);
IPSOCKET1:=@IPOpenReceiveSocket("";80;"TCP");
IF(@GetDataType(IPSOCKET1)="IPS")
{
LOOP:=1;
WHILE(LOOP)
{
ConSocket:=@IPWaitForConnection(IPSOCKET1;RETIPHOST2);
IF(@GetDataType(ConSocket)="IPS")
{
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 is closed again immediately.
When the task is terminated, the receiving IPSOCKET IPSOCKET1 is also closed again.
Note : This text was machine-translated and may contain inaccuracies.
