diff --git a/src/Jaeger/UDPClient.php b/src/Jaeger/UDPClient.php index edcf283..ad63dec 100644 --- a/src/Jaeger/UDPClient.php +++ b/src/Jaeger/UDPClient.php @@ -86,17 +86,19 @@ public function emitBatch(Batch $batch) $client = new AgentClient(null, $protocol); $client->emitBatch($batch); - $data = $buffer->getBuffer(); try { - socket_sendto( - $socket, - $data, - strlen($data), - 0, - $this->host, - $this->port - ); + while ($buffer->available()) { + $data = $buffer->read(65536); // max size of DGRAM packet + socket_sendto( + $socket, + $data, + strlen($data), + ( $buffer->available() ) ? MSG_EOR : MSG_EOF, + $this->host, + $this->port + ); + } } finally { socket_close($socket); }