从客户端PHP写入服务器C ++后,如何保持连接套接字的存活

I'm trying to make a socket connection between a PHP aplication and a C++ aplication, but I don't know why I can't keep alive the connection between those 2 applications after I wrote from PHP. This is my socket-client:

$host    = "172.12.10.1";
$port    = '7054';
$factory = new Factory();
$socket = $factory->createClient($host.':'.$port);
echo 'Client connected to ' . $socket->getPeerName() . PHP_EOL . PHP_EOL."<br>";
$strSndMsg="TEST";
$socket->write($strSndMsg);
var_dump($socket->read(8192));
$socket->close();

So like I said, after $socket->write($strSndMsg) was executed the C++ app show me "Client connect- Cliente disconnect - Test" but I didn't get a response in my $socket->read(8192). Can somebody help me please!?