Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public function __construct(Options $options)
  2. {
  3. $this->responseBuffer = new Response();
  4. $this->connection = stream_socket_client($options->fullSocketAddress());
  5.  
  6. if (!$this->isAlive($this->connection)) {
  7. throw new DeadSocket();
  8. }
  9.  
  10. stream_set_timeout($this->connection, $this->timeout);
  11. $this->options = $options;
  12. }
  13.  
  14. public function send(string $xml)
  15. {
  16. try {
  17. fwrite($this->connection, $xml);
  18. } catch (Exception $e) {
  19. $this->options->getLogger()->error(__METHOD__ . '::' . __LINE__ . " fwrite() failed " . $e->getMessage());
  20. return;
  21. }
  22. }
  23.  
  24. if (!is_resource($this->connection)) $this->reconnect();
  25.  
  26. if (!$this->connection) $this->reconnect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement