Packet Sending Buffering

This commit is contained in:
Shoghi Cervantes Pueyo 2013-03-16 00:09:00 +01:00
parent ffaaca6f2d
commit fc06e1bcaf
5 changed files with 86 additions and 46 deletions

View file

@ -76,14 +76,12 @@ class UDPSocket{
socket_set_nonblock($this->sock);
}
public function read(){
public function read(&$buf, &$source, &$port){
if($this->connected === false){
return array(3 => false);
return false;
}
$source = false;
$port = 1; //$source and $port will be overwritten
$len = @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port);
return array($buf, $source, $port, $len);
return $len;
}
public function write($data, $dest = false, $port = false){