[TASK] Added function for clients, so they're able to send initial data right after connecting to a server.
[TASK] Restructured parts of the core to support sending data right after connecting. [TASK] Adapted core part for automatic reconnect to support sending initial data, too.
This commit is contained in:
@@ -71,8 +71,8 @@ class Socket_SocketPool {
|
||||
* @return ressource
|
||||
*/
|
||||
public function createTcpSocket($IPv6 = FALSE) {
|
||||
$Domain = ($IPv6) ? AF_INET6 : AF_INET;
|
||||
$socket = socket_create($Domain, SOCK_STREAM, SOL_TCP);
|
||||
$domain = ($IPv6) ? AF_INET6 : AF_INET;
|
||||
$socket = socket_create($domain, SOCK_STREAM, SOL_TCP);
|
||||
socket_set_block($socket);
|
||||
if($socket === FALSE) throw new Exception_SocketException("socket_create() failed!", 1290273709);
|
||||
$this->addSocket($socket);
|
||||
@@ -90,7 +90,7 @@ class Socket_SocketPool {
|
||||
*/
|
||||
public function select($read, $write, $except, $timeout = NULL) {
|
||||
$n = socket_select($read, $write, $except, $timeout);
|
||||
if($n === FALSE) throw new Exception_SocketException("socket_select() failed!", 1290273693);
|
||||
if($n === FALSE) throw new Exception_SocketException("socket_select() failed! - Error: " . socket_strerror(socket_last_error()), 1290273693);
|
||||
if($n === 0) return array("read" => array(), "write" => array(), "except" => array());
|
||||
return array("read" => $read, "write" => $write, "except" => $except);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user