dev-master
9999999-dev https://github.com/devster/uservMicro PHP library to build a socket server
MIT
The Requires
- php >=5.3.3
- ext-pcntl *
micro library server socket
Wallogit.com
2017 © Pedro Peláez
Micro PHP library to build a socket server
Micro PHP Socket server library, (*2)
! work in progress! For now only tested on ubuntu, PHP 5.4 This lib should be used only in CLI, because of the use of pcntl_fork, (*3)
Create a php file and copy the code below., (*4)
require 'vendor/autoload.php';
use Userv\Server;
use Userv\Connection\TelnetConnection;
$serv = new Server('127.0.0.1', 23);
$serv
->setConnection(new TelnetConnection)
->setHandler(function($conn) {
$conn->writeln('Hello, welcome on this telnet server, bouya!');
$name = $conn->ask('What\'s your name? : ');
$conn->writeln('Your name is '.$name);
})
;
$serv->run();
Then run this file as CLI script: sudo php myserver.php., (*5)
Now open a new terminal and try telnet localhost., (*6)
Micro PHP library to build a socket server
MIT
micro library server socket