QLocalSocket get filedescriptor

  • Hi

    I am trying to communicate with mplayer on linux. Mplayer can accept an input file which can be a pipe. It is not stated that it can't be anything else so i want to try the use with QLocalSocket because i want to run the software on windows too eventually.

    How do i get the Filedescriptor to the socket created in this code? Something is located in /tmp/qt../sub_socket but since this path is not fix at all i need to get the path at runtime.

    QLocalSocket s;

    qDebug() << "connected" << endl;
    qDebug() << s.objectName() << endl;
    qDebug() << s.serverName() << endl;


    objectName and serverName are Empty..

  • Hi,

    to access to file descriptor you should use QLocalSocket::socketDescriptor().

    To set Object Name you use setObjectName ().

    serverName () is empty if connection fails; you checked the return value of waitForConnected()?

  • Thanks.

    I found out that using LocalSocket together with LocalServer is the way to go for normal IPC. Its just too bad that there is no chance to use the systemc messaging capabilities with the same code running on different platforms.

    This topic is closed.

    Solution is to use fifos to interact with mplayer.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.