mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
Packet Sending Buffering
This commit is contained in:
parent
ffaaca6f2d
commit
fc06e1bcaf
5 changed files with 86 additions and 46 deletions
|
|
@ -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){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue