File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * usage: php examples/telnet.php 127.0.0.1 4730
4+ */
5+
6+ error_reporting (E_ALL | E_STRICT );
7+
8+ require dirname (__DIR__ ) . '/../../autoload.php ' ;
9+ date_default_timezone_set ('Asia/Shanghai ' );
10+
11+ global $ argv ;
12+ $ opts = getopt ('h ' , ['help ' ]);
13+
14+ if (isset ($ opts ['h ' ]) || isset ($ opts ['help ' ])) {
15+ $ script = array_shift ($ argv );
16+ $ script = \Inhere \Library \Helpers \Cli::color ($ script , 'light_green ' );
17+ $ help = <<<EOF
18+ Start a telnet client.
19+
20+ Usage:
21+ $ script HOST [PORT]
22+
23+ Options:
24+ -h,--help Show this help information
25+ \n
26+ EOF ;
27+ exit ($ help );
28+ }
29+
30+ $ host = $ argv [1 ] ?? '127.0.0.1 ' ;
31+ $ port = $ argv [2 ] ?? 80 ;
32+
33+ printf ("Connect to the server {$ host }: {$ port }" );
34+
35+ $ tt = new \Inhere \LibraryPlus \Network \Telnet ($ host , $ port );
36+
37+ // var_dump($tt);die;
38+
39+ //echo $tt->command('status');
40+ $ tt ->interactive ();
Original file line number Diff line number Diff line change 1414
1515/**
1616 * Class ProcessLogger
17- * @package inhere \process
17+ * @package Inhere \process
1818 */
1919class ProcessLogger implements ProcessLogInterface
2020{
You can’t perform that action at this time.
0 commit comments