Created
August 27, 2017 12:15
-
-
Save BenMorel/efadaa0dad4927c6fcafdc66e8d28dbf to your computer and use it in GitHub Desktop.
(Medium) Sample PHP server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); | |
socket_bind($sock, '0.0.0.0', 10000); | |
for (;;) { | |
socket_recvfrom($sock, $message, 1024, 0, $ip, $port); | |
$reply = str_rot13($message); | |
socket_sendto($sock, $reply, strlen($reply), 0, $ip, $port); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where is the closing ?> ?
But realy a great article about creating a systemd service ("Creating a Linux service with systemd"). Thanks!