Hi All!
How send socket descriptor in command prompt arguments on Linux without using fork function?
I try this:
void Server::incomingConnection( int handle )
{
...
fork_process
->setEnvironment
( QProcess::systemEnvironment() );
fork_process
->setProcessChannelMode
( QProcess::MergedChannels );
process_args << "SD";
process_args <<
QString::number( handle
);
if (!fork_process->waitForStarted())
{
qDebug() << "fork_process Error: " << fork_process->errorString();
delete fork_process;
fork_process = 0;
return;
}
connect( fork_process,
SIGNAL(finished
(int,
QProcess::ExitStatus)),
this,
SLOT(processFinished
(int,
QProcess::ExitStatus)) );
...
}
void Server::incomingConnection( int handle )
{
...
QProcess *fork_process = new QProcess( this );
fork_process->setEnvironment( QProcess::systemEnvironment() );
fork_process->setProcessChannelMode( QProcess::MergedChannels );
fork_process->setWorkingDirectory( QCoreApplication::applicationDirPath() );
QStringList process_args;
process_args << "SD";
process_args << QString::number( handle );
fork_process->start( QCoreApplication::applicationFilePath(), process_args );
if (!fork_process->waitForStarted())
{
qDebug() << "fork_process Error: " << fork_process->errorString();
delete fork_process;
fork_process = 0;
return;
}
connect( fork_process, SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(processFinished(int,QProcess::ExitStatus)) );
...
}
To copy to clipboard, switch view to plain text mode
On Windows it work fine, but on Linux I'm get error: Invalid socket descriptor.
Bookmarks