-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
96 lines (76 loc) · 1.53 KB
/
index.php
File metadata and controls
96 lines (76 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
class A {
private $a = 1;
public function __construct()
{
echo 'i am a';
}
}
class B extends A {
public function __construct()
{
parent::__construct();
$this->a = 2;
echo 'i am b';
}
}
abstract class C {
abstract public function a();
}
class D {
public $_data;
public function __construct($data)
{
$this->_data = $data;
}
public function sdfsdf()
{
echo '2';
}
}
/* $d = new D(['aaa' => 1,'bbb' => 2]);
foreach ($d as $key=>$val) {
echo $key.$val;
}
*/
if (!extension_loaded('sockets')) {
die('The sockets extension is not loaded.');
}
/* $fp = fsockopen("tcp://192.168.1.103", 8000, $errno, $errstr);
if (!$fp) {
echo "ERROR: $errno - $errstr<br />\n";
} else {
while (true) {
$read = fread($fp, 100);
var_dump($read);
$words = fgets(STDIN);
$length = fwrite($fp,$words);
if ($words=="bye\r\n") {
break;
}
}
fclose($fp);
}
exit(); */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
//var_dump($socket);exit();
//socket_set_nonblock($socket);
$con = socket_connect($socket,'127.0.0.1',8002);
//var_dump($con);
if (!$con) {
socket_close($socket);
exit;
}
echo "Link\n";
while ($con) {
$words=fgets(STDIN);
socket_write($socket,$words);
if ($words=="bye\r\n") {
break;
}
$hear = socket_read($socket,1024);
var_dump($hear);
}
socket_shutdown($socket);
socket_close($socket);
?>