Created
February 15, 2015 16:54
-
-
Save Pierozi/2f258cac9842e36d4ab5 to your computer and use it in GitHub Desktop.
Create UDP Server Socket with Hoa library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include(dirname(__DIR__) . '/vendor/autoload.php'); | |
$server = new Hoa\Socket\Server('udp://0.0.0.0:3655'); | |
$server->connectAndWait(); | |
$server->considerRemoteAddress(true); | |
do { | |
$line = bin2hex($server->read(32)); | |
echo '< ', $line, "\n"; | |
$msg = hex2bin($line); | |
$server->write($msg, strlen($msg)); | |
} while (true); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment