This class allow a TCP connection to be established to a server.
It allow SSL connection to be enable too.
$tcpclient = new Domframework\\Tcpclient ("domframework.fournier38.fr", 80);
$tcpclient->connect ();
list ($address, $port, $localAddress, $localPort) =
  $tcpclient->getInfo ();
$tcpclient->send ("GET / HTTP/1.1\r\n".
  "Host: domframework.fournier38.fr\r\n".
  "User-Agent: DomFramework\r\n".
  "Accept: *"."/*\r\n".
  "\r\n");
$res = "";
while (($read = $tcpclient->read ()) !== "")
  echo $read."\r\n";
$tcpclient->disconnect ();The SSL encryption need to stream to be in blocked mode.
$tcpclient->cryptoEnable (true);Namespace Domframework
/** TCP Client Allow to create TCP connections to a server. If both IPv6 and IPv4 are allowed by the server, try in IPv6 then back in IPv4 if it doesn't works. If the name of the server is provided instead of the IP, look for all the IP address, manage the CNAME aliases. If multiple addresses are available in IPv6 or IPv4, randomize them to allow round-robin connections to the server. Manage the timeout, send a command, receive a max number of bytes, allow SSL trafic with CA verification
No property available
/** Initialize the object, by setting the name or the IP of the server@param string $ipOrNameThe IP or the name of the server@param integer $portThe port of the server to connect
/** Initialize the connection to the server Return the socket
/** Activate the SSL connection. Put the socket in blocking mode, as it is mandatory to have SSL connection@param boolean $valTrue to activate, false to disable SSL@param integer|null $cryptoMethodThe cryptoMethod allowed@param array|null $optionsCan overload the SSL options if needed@returnboolean false if the client can not found a encryption method with the server
/** Disconnect the socket
/**
 Get the connection peer address, peer port and localaddress and localport
 @return array
/** Get meta data, like the timeout state, the crypto protocol and ciphers...
/**
 Get the socket to direct access
 @return resource The socket with the client
/**
 Set/get the preferIPv4 property
 @param boolean|null $preferIPv4 The preferIPv4 property to set (or to get
 if null)
/** Read the data from the server. The connection must be established Use the readMode in text or binary (text by default) In text mode, the read return when found the first \r\n, and doesn't returns the \r\n.@param integer $maxLengthLimit the length of the data from the server@returnstring The content
/**
 Set/get the read mode : text or binary
 @param string|null $readMode The mode to set (or get if null)
/**
 Send a data to the server.
 The connection must be established
 @param mixed $data The data to send
/**
 Set/get the timeout
 @param integer|null $timeout The timeout in seconds