Concept Framework 2.2 documentation Contents | Index

standard.net.socket.SocketClose

Name Version Deprecated
SocketClose version 1.0 no

Prototype:
number SocketClose(number socket)

Parameters:
socket      a valid and socket descriptor, as returned by SocketCreate

Description:
Closes a socket. After a socket is closed, it cannot be used.

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

Returns:
Returns 0 if succeeded, or -1 if failed. This function fails is socket is not a socket descriptor, the network subsystem fails, a blocking socket call is in progress, or the service provider is still processing a callback function or the socket is marked as nonblocking and SO_LINGER is set to a nonzero time-out value.

Documented by Eduard Suica, generation time: Sun Jan 27 18:15:17 2013 GMT(c)2013 Devronium Applications