Skip to content

Instantly share code, notes, and snippets.

@ikariiin
Created March 18, 2017 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikariiin/ca7d66ba7057bb8b9bab78137d79702e to your computer and use it in GitHub Desktop.
Save ikariiin/ca7d66ba7057bb8b9bab78137d79702e to your computer and use it in GitHub Desktop.
<?php
$socket = new \Socket(\Socket::AF_INET, \Socket::SOCK_STREAM, \Socket::SOL_TCP);
$port = random_int(3333, 9999);
$socket->bind('0.0.0.0', $port);
echo "Listening on port $port\n";
class Listener extends Thread {
private $client;
public function __construct(\Socket $client) {
$this->client = $client;
}
public function run() {
try {
$this->client->write("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<h1 style='font-size: 150px;'>So far, so good!</h1>");
$this->client->close();
} catch (\Throwable $throwable) {
echo $throwable->getMessage() . "\n";
var_dump($throwable->getTrace());
}
}
};
do {
$socket->listen(1);
$client = $socket->accept();
if(!$client)
continue;
echo "Received Data: " . $client->read(4096);
$listen = new \Listener($client);
$listen->start() && $listen->join();
} while (true);
@ikariiin
Copy link
Author

Is this the real life?
Is this just fantasy?
Caught in a landslide,
No escape from reality.

Open your eyes,
Look up to the skies and see,
I'm just a poor boy, I need no sympathy,
Because I'm easy come, easy go,
Little high, little low,
Any way the wind blows doesn't really matter to me, to me.

Mama, just killed a man,
Put a gun against his head,
Pulled my trigger, now he's dead.
Mama, life had just begun,
But now I've gone and thrown it all away.

Mama, ooh,
Didn't mean to make you cry,
If I'm not back again this time tomorrow,
Carry on, carry on as if nothing really matters.

Too late, my time has come,
Sends shivers down my spine,
Body's aching all the time.
Goodbye, everybody, I've got to go,
Gotta leave you all behind and face the truth.

Mama, ooh (any way the wind blows),
I don't wanna die,
I sometimes wish I'd never been born at all.

I see a little silhouetto of a man,
Scaramouche, Scaramouche, will you do the Fandango?
Thunderbolt and lightning,
Very, very frightening me.
(Galileo) Galileo.
(Galileo) Galileo,
Galileo Figaro
Magnifico-o-o-o-o.

I'm just a poor boy, nobody loves me.
He's just a poor boy from a poor family,
Spare him his life from this monstrosity.

Easy come, easy go, will you let me go?
Bismillah! No, we will not let you go. (Let him go!)
Bismillah! We will not let you go. (Let him go!)
Bismillah! We will not let you go. (Let me go!)
Will not let you go. (Let me go!)
Never, never let you go
Never let me go, oh.
No, no, no, no, no, no, no.
Oh, mama mia, mama mia (Mama mia, let me go.)
Beelzebub has a devil put aside for me, for me, for me.

So you think you can stone me and spit in my eye?
So you think you can love me and leave me to die?
Oh, baby, can't do this to me, baby,
Just gotta get out, just gotta get right outta here.

(Ooooh, ooh yeah, ooh yeah)

Nothing really matters,
Anyone can see,
Nothing really matters,
Nothing really matters to me.

Any way the wind blows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment