Skip to content

Instantly share code, notes, and snippets.

@chobie
Created May 26, 2012 13:37
Show Gist options
  • Save chobie/2793976 to your computer and use it in GitHub Desktop.
Save chobie/2793976 to your computer and use it in GitHub Desktop.
php-uv exsample
<?php
$server = uv_tcp_init();
uv_tcp_bind($server, "0.0.0.0",5150);
uv_listen($server,1000,function($server){
$client = uv_tcp_init();
uv_accept($server,$client);
uv_read_start($client, function($buffer, $client){
uv_write($client,"Hello\n",function($status, $client){
uv_close($client,function($handle){
echo "close\n";
});
});
});
});
uv_run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment