Split all files mith multiple classes into multiple files
This commit is contained in:
64
src/HttpConnection.php
Normal file
64
src/HttpConnection.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/** DomFramework
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework;
|
||||
|
||||
/**
|
||||
* Manage the HTTP Connections.
|
||||
* Used by HttpServer
|
||||
*/
|
||||
class HttpConnection
|
||||
{
|
||||
private $tcpserver;
|
||||
private $clientAddress;
|
||||
private $clientPort;
|
||||
private $localAddress;
|
||||
private $localPort;
|
||||
private $logger;
|
||||
|
||||
public function __construct($tcpserver)
|
||||
{
|
||||
$this->tcpserver = $tcpserver;
|
||||
list($clientAddress, $clientPort, $localAddress, $localPort) =
|
||||
$tcpserver->getInfo();
|
||||
// If the address is in IPv4 in IPv6 (syntax : "::ffff:127.0.0.1"),
|
||||
// update it to IPv4 only
|
||||
if (substr($clientAddress, 0, 7) === "::ffff:") {
|
||||
$clientAddress = substr($clientAddress, 7);
|
||||
}
|
||||
$this->clientAddress = $clientAddress;
|
||||
$this->clientPort = $clientPort;
|
||||
$this->localAddress = $localAddress;
|
||||
$this->localPort = $localPort;
|
||||
echo "OK : $localAddress:$localPort";
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
}
|
||||
|
||||
public function getClientAddress()
|
||||
{
|
||||
return $this->clientAddress;
|
||||
}
|
||||
|
||||
public function getClientPort()
|
||||
{
|
||||
return $this->clientPort;
|
||||
}
|
||||
|
||||
public function getLocalAddress()
|
||||
{
|
||||
return $this->localAddress;
|
||||
}
|
||||
|
||||
public function getLocalPort()
|
||||
{
|
||||
return $this->localPort;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user