im using reactphp library , and im working with a device that sends packages in different sizes. My problem is when i get the data
$stream->on('data', function ($data, React\Stream\ReadableStreamInterface $stream) {
$this->respuesta .= $data;
$stream->close();
});
I only get a part of the first package. Is there a way to keep waiting until the device sends all the data?
Here, on the wireshark capture the last package is the one that i cant get with react.
$loop = React\EventLoop\Factory::create();
$dnsResolverFactory = new React\Dns\Resolver\Factory();
$dns = $dnsResolverFactory->createCached('8.8.8.8', $loop);
$connector = new React\SocketClient\Connector($loop, $dns);
$connector->create($this->host, $this->port)->then(function (React\Stream\Stream $stream) use ($hex) {
$stream->write($hex);
$stream->on('data', function ($data, React\Stream\ReadableStreamInterface $stream) {
$this->respuesta .= $data;
$stream->close();
});
});
$loop->run();