Hi there. I have a Qt based service which essentially contains this
s = server.nextPendingConnection();
// ..snip.. (read a command string from s)
s->write(some_string);
s->waitForBytesWritten(-1);
delete s;
s = server.nextPendingConnection();
// ..snip.. (read a command string from s)
s->write(some_string);
s->waitForBytesWritten(-1);
delete s;
To copy to clipboard, switch view to plain text mode
A PHP web page connects to it with code like this
$command = some_stuff;
$socket = socket_create ( ..snip.. );
socket_connect ($socket, $address, $port);
$command = some_stuff;
socket_write ($socket, $command, strlen($command));
$p = socket_read ($socket, 100, PHP_NORMAL_READ);
socket_close ($socket);
To copy to clipboard, switch view to plain text mode
The Qt service reads the command string fine, but the PHP errors on socket_read saying "connection reset by peer". I guess this means Qt deletes the socket before the read is finished. I could make the PHP write an "I'm finished" string, but that doesn't alter the fundamental problem. How do I make Qt not close the socket until socket_read has finished?
Thanks.
Bookmarks