Easy Socket(UDP) Creating API for PocketMine Plugin developers. NSFE Codes.
$port = 19133;
$socket = \drmyo\SocketAPI\SocketAPI::getInstance()->createSocket($port); //The method SocketAPI::createSocket(int $port) returns \drmyo\SocketAPI\UDPSocket.
\drmyo\SocketAPI\SocketAPI::getInstance()->getSocket(19133)->sendPacket(new \drmyo\SocketAPI\DataPacket($ip, $port, $data));
public function onSocketReceive(\drmyo\SocketAPI\events\SocketReceiveEvent $event){
$event->getPacket(); //returns \drmyo\SocketAPI\DataPacet
//do something you want !
}
I'm sorry for providing you deficient informations, also not providing PHPDocs, example plugins. They will be added soon.