/** * Flush the event queues and send the data * * @return int|bool */ public function flush() { $res = true; if (count($this->events)) { if ($this->active) { $message = new Message(); $message->events = $this->events; $res = $this->socket->write($message->serialize()); } $this->events = []; } return $res; }
public function testWriteIfSocketClosedReturnFalse() { $socket = new UdpSocket('localhost', 0); $socket->close(); $this->assertEquals(false, $socket->write('something')); }