standard.net.socket.SocketCreate

SocketCreate is available since version 1.0.

Prototype:

number SocketCreate(nTYPE=PROTOCOL_TCP)

Parameters

nTYPE
protocol type. Can be PROTOCOL_TCP or PROTOCOL_UDP

Description:

Creates a socket.

Return value:

Returns a socket descriptor, if succeeded, or -1 if failed.

Example
import standard.net.socket

class Main {
	function Main() {
		var s=SocketCreate();

		echo "Connecting ... ";
		if (SocketConnect(s,"localhost",3500)==-1) {
			echo "Couldn't Connect :"+SocketError(s)+"\n";
			return 0;
		}

		echo "Connected !\n";

		for (var i=0;i<10;i++)
			echo SocketWrite(s,"SUPERMAN $i !");
		SocketClose(s);
	}
}