PDA

View Full Version : QLocalSocket connection error



David_
4th December 2012, 13:22
Hi,

I am using qlocalsocket to establish connection with another program on the same machine. The server has been wrote in c and it works fine.
The client has been wrote in qt. (using qlocalsocket.)
This is my simple example:
LocalSocket socket;
socket.connectToServer(“mySocket”);
socket.open(QIODevice::ReadWrite);
But I got erro like this: No such file or directory.
I checked whether mySocket is created by server or not. It did.
What could be the problem?
Thanks, David

wysota
4th December 2012, 13:52
Are you using a relative or absolute path to the socket?

David_
4th December 2012, 14:24
The two programs are in the same place. So I use relative path.
By the way I tested the following:
I wrote this:
QLocalSocket *mySocket = new QLocalSocket();
I got error: Resource temporarily unavailable

wysota
4th December 2012, 14:25
The two programs are in the same place. So I use relative path.
So use an absolute one. It doesn't matter if they are in the same place or not. What matters is their current working directory.

David_
4th December 2012, 14:26
I searched a lot and I found that the problem may with the socket. I mean there may are too many socket in open mod.