Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. protected function connect($host) {
  2.  
  3. $remote_socket = $host . ':' . $this->connect_port;
  4.  
  5. $errnum = 0;
  6.  
  7. $errstr = '';
  8.  
  9. $this->host = $remote_socket;
  10.  
  11. // open connection
  12.  
  13. $this->socket = @stream_socket_client(
  14.  
  15. $this->host,
  16.  
  17. $errnum,
  18.  
  19. $errstr,
  20.  
  21. $this->connect_timeout,
  22.  
  23. STREAM_CLIENT_CONNECT,
  24.  
  25. stream_context_create(array())
  26.  
  27. );
  28.  
  29. // connected?
  30.  
  31. if (!$this->connected()) {
  32.  
  33. throw new SMTP_Validate_Email_Exception_No_Connection('Cannot ' .
  34.  
  35. 'open a connection to remote host (' . $this->host . ')');
  36.  
  37. }
  38.  
  39. $result = stream_set_timeout($this->socket, $this->connect_timeout);
  40.  
  41. if (!$result) {
  42.  
  43. throw new SMTP_Validate_Email_Exception_No_Timeout('Cannot set timeout');
  44.  
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement