Advertisement
AnotherTest

Client Example

Jun 21st, 2011
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2. // Indefinite execution
  3. set_time_limit (0);
  4. // IP and port
  5. $strIp = '';
  6. $intPort = 9000; // 9000 is a good port
  7. $strClientIP = getHostByName(gethostname());
  8. // Create a TCP Stream socket
  9. $resSock = socket_create(AF_INET, SOCK_STREAM, 0);
  10. // Connect to the server
  11. socket_connect($resSock, $strIp, $intPort) or die('Could not bind to address');
  12.  
  13. socket_write($resSock, 'CONNECT~' . $strClientIP);
  14. // Close connection with server
  15. socket_close($resSock);
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement