Inheritance diagram for ilBMFServer_TCP:
Collaboration diagram for ilBMFServer_TCP:Public Member Functions | |
| ilBMFServer_TCP ($localaddr="127.0.0.1", $port=10000, $listen=5, $reuse=TRUE) | |
| run () | |
| service (&$data) | |
Data Fields | |
| $headers = array() | |
| $localaddr | |
| $port | |
| $listen | |
| $reuse | |
Definition at line 43 of file class.ilBMFServer_TCP.php.
| ilBMFServer_TCP::ilBMFServer_TCP | ( | $ | localaddr = "127.0.0.1", |
|
| $ | port = 10000, |
|||
| $ | listen = 5, |
|||
| $ | reuse = TRUE | |||
| ) |
Definition at line 50 of file class.ilBMFServer_TCP.php.
References $listen, $localaddr, $port, $reuse, and ilBMFServer::ilBMFServer().
{
parent::ilBMFServer();
$this->localaddr = $localaddr;
$this->port = $port;
$this->listen = $listen;
$this->reuse = $reuse;
}
Here is the call graph for this function:| ilBMFServer_TCP::run | ( | ) |
Definition at line 59 of file class.ilBMFServer_TCP.php.
References $data, ilBMFBase_Object::_raiseSoapFault(), and service().
{
if (($sock = socket_create (AF_INET, SOCK_STREAM, 0)) < 0) {
return $this->_raiseSoapFault("socket_create() failed: reason: " . socket_strerror ($sock));
}
if ($this->reuse &&
!@socket_setopt($sock,SOL_SOCKET,SO_REUSEADDR,1)) {
return $this->_raiseSoapFault("socket_setopt() failed: reason: ".socket_strerror(socket_last_error($sock)));
}
if (($ret = socket_bind ($sock, $this->localaddr, $this->port)) < 0) {
return $this->_raiseSoapFault("socket_bind() failed: reason: " . socket_strerror ($ret));
}
# print "LISTENING on {$this->localaddr}:{$this->port}\n";
if (($ret = socket_listen ($sock, $this->listen)) < 0) {
return $this->_raiseSoapFault("socket_listen() failed: reason: " . socket_strerror ($ret));
}
do {
$data = NULL;
if (($msgsock = socket_accept($sock)) < 0) {
$this->_raiseSoapFault("socket_accept() failed: reason: " . socket_strerror ($msgsock));
break;
}
# print "Accepted connection\n";
while ($buf = socket_read ($msgsock, 8192)) {
if (!$buf = trim($buf)) {
continue;
}
$data .= $buf;
}
if ($data) {
$response = $this->service($data);
# write to the socket
if (!socket_write($msgsock, $response, strlen($response))) {
return $this->_raiseSoapFault('Error sending response data reason '.socket_strerror());
}
}
socket_close ($msgsock);
} while (true);
socket_close ($sock);
}
Here is the call graph for this function:| ilBMFServer_TCP::service | ( | &$ | data | ) |
Definition at line 104 of file class.ilBMFServer_TCP.php.
References $data, and ilBMFServer::parseRequest().
Referenced by run().
{
# XXX we need to handle attachments somehow
return $this->parseRequest($data,$attachments);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilBMFServer_TCP::$headers = array() |
Reimplemented from ilBMFServer.
Definition at line 44 of file class.ilBMFServer_TCP.php.
| ilBMFServer_TCP::$listen |
Definition at line 47 of file class.ilBMFServer_TCP.php.
Referenced by ilBMFServer_TCP().
| ilBMFServer_TCP::$localaddr |
Definition at line 45 of file class.ilBMFServer_TCP.php.
Referenced by ilBMFServer_TCP().
| ilBMFServer_TCP::$port |
Definition at line 46 of file class.ilBMFServer_TCP.php.
Referenced by ilBMFServer_TCP().
| ilBMFServer_TCP::$reuse |
Definition at line 48 of file class.ilBMFServer_TCP.php.
Referenced by ilBMFServer_TCP().
1.7.1