Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- const SERVER_IP = "0.0.0.0"; //change to your server's IP or else it will fail to bind the socket
- const FILE_NAME = "Tesseract.sprx"; //change to the relative file location for the file you want to transfer
- $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
- socket_bind($socket, SERVER_IP, 6969);
- socket_listen($socket);
- while (true) {
- $client = socket_accept($socket);
- $file = file_get_contents(FILE_NAME);
- socket_write($client, $file);
- //echo "successfully sent " . filesize(FILE_NAME) . " bytes to client\n";
- socket_close($client);
- }
- socket_close($socket);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement