mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
Entity velocity
This commit is contained in:
parent
0fa3dded89
commit
aef32f2012
3 changed files with 22 additions and 26 deletions
|
|
@ -30,29 +30,22 @@ the Free Software Foundation, either version 3 of the License, or
|
|||
class UDPSocket{
|
||||
private $encrypt;
|
||||
var $buffer, $connected, $errors, $sock, $server;
|
||||
function __construct($server, $port, $listen = false, $socket = false){
|
||||
function __construct($server, $port, $listen = false){
|
||||
$this->errors = array_fill(88,(125 - 88) + 1, true);
|
||||
$this->server = $server;
|
||||
$this->port = $port;
|
||||
if($socket !== false){
|
||||
$this->sock = $socket;
|
||||
$this->sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||
socket_set_option($this->sock, SOL_SOCKET, SO_BROADCAST, 1); //Allow sending broadcast messages
|
||||
if($listen !== true){
|
||||
$this->connected = true;
|
||||
$this->buffer = array();
|
||||
$this->unblock();
|
||||
}else{
|
||||
$this->sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
|
||||
socket_set_option($this->sock, SOL_SOCKET, SO_BROADCAST, 1);
|
||||
if($listen !== true){
|
||||
$this->connected = true;
|
||||
$this->buffer = array();
|
||||
if(socket_bind($this->sock, "0.0.0.0", $port) === true){
|
||||
$this->unblock();
|
||||
}else{
|
||||
if(socket_bind($this->sock, "0.0.0.0", $port) === true){
|
||||
$this->unblock();
|
||||
}else{
|
||||
console("[ERROR] Couldn't bind to 0.0.0.0:".$port, true, true, 0);
|
||||
die();
|
||||
}
|
||||
console("[ERROR] Couldn't bind to 0.0.0.0:".$port, true, true, 0);
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue