/** * Creates the socket instance * * @param string socket default NULL * @return peer.Socket */ public function newInstance($socket = NULL) { $sock = new BSDSocket(NULL === $socket ? $this->locate() : $socket, -1); $sock->setDomain(AF_UNIX); $sock->setType(SOCK_STREAM); $sock->setProtocol(0); return $sock; }
/** * Constructor * * @param string host * @param int port * @param int domain default AF_INET (one of AF_INET or AF_UNIX) * @param int type default SOCK_STREAM (one of SOCK_STREAM | SOCK_DGRAM | SOCK_RAW | SOCK_SEQPACKET | SOCK_RDM) * @param int protocol default SOL_TCP (one of SOL_TCP or SOL_UDP) */ public function __construct($host, $port, $domain = AF_INET, $type = SOCK_STREAM, $protocol = SOL_TCP) { $this->domain = $domain; $this->type = $type; $this->protocol = $protocol; parent::__construct($host, $port); }