System_Socket
[ class tree: System_Socket ] [ index: System_Socket ] [ all elements ]

Source for file debugger.php

Documentation is available at debugger.php

  1. <?php
  2.  
  3. /**
  4. * Simple debugger example
  5. * $Id: debugger.php,v 1.5 2004/04/25 16:31:19 mike Exp $
  6. */
  7.  
  8. require_once 'System/Socket/Creator.php';
  9. require_once 'System/Socket/Debugger.php';
  10.  
  11. /**
  12. * If we define SYSTEM_SOCKET_DEBUG, a System_Socket_Debugger object
  13. * gets automagically attached {@link System_Socket_Manager::attach()}
  14. * to every System_Socket_Manager (Connection/Listener) we create.
  15. * So be carefull with this option!
  16. */
  17. define('SYSTEM_SOCKET_DEBUG'SYSTEM_SOCKET_DEBUG_ECHO);
  18.  
  19. /**
  20. * Here we create a new System_Socket_Connection object with the
  21. * specified parameters passed to the underlying System_Socket.
  22. * Note that our debugger will be automatically attached!
  23. */
  24. $conn &System_Socket_Creator::createTcpConnection('pear.php.net'80);
  25.  
  26. // just check if we actually got a System_Socket_Connection returned
  27. if (PEAR::isError($conn)) {
  28.     die($conn->getMessage());
  29. }
  30.  
  31. /**
  32. * We now send a simple HTTP GET request through the socket connection and our
  33. * System_Socket_Debugger will comment each action taken. (watch the output)
  34. */
  35. $conn->writeLine('HEAD / HTTP/1.1');
  36. $conn->writeLine('Host: pear.php.net');
  37. $conn->writeLine('Connection: close');
  38. $conn->writeLine('User-Agent: PEAR::System::Socket');
  39. $conn->writeLine();
  40. while ($conn->read());
  41.  
  42. ?>

Documentation generated on Mon, 11 Mar 2019 10:15:56 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.