Skip to content

Instantly share code, notes, and snippets.

@kYroL01
Forked from BenMorel/server.php
Created July 25, 2020 15:26
Show Gist options
  • Save kYroL01/7f5e251d4ca799dc475e457f0dfe07ee to your computer and use it in GitHub Desktop.
Save kYroL01/7f5e251d4ca799dc475e457f0dfe07ee to your computer and use it in GitHub Desktop.
(Medium) Sample PHP server
<?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