Re: Working with QUdpSocket
first, leave the BindFlags away. I dont know if they arent causing the error.
Code:
if(m_udpsocket->bind(port))
qDebug("Bind Success");
else
qDebug("Bind Fail");
and second you should compile your app with CONFIG += console to see if theres an error with your connect method. your method should look like that:
Code:
connect(udpsocket, SIGNAL(readyRead()),
this, SLOT(readDatagram()));
Re: Working with QUdpSocket
No i am not getting that kind of errors with the connect statement.
CONFIG += console is added.
The slot is called when both the server and client runs in different pc's. but since the bind is failed the udpsocket is in an unconnected state and hence the slot is not getting called.
when they are run in different pc's the socket is in boundstate.
Re: Working with QUdpSocket
Re: Working with QUdpSocket
The Error string was QAbstractSocket::AddressInUseError.
But the problem is solved in the server side i tried to use
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))
it worked. Thanks everybody for the responses and time.
Re: Working with QUdpSocket
I had this happen when I had one socket sending one way and another socket sending another. A lot of copy/pasting was going on and I forgot to update one of the methods to use the commandSocket instead of the dataSocket.
Hope that helps somebody.
Re: Working with QUdpSocket
Hey Caudel,
Thanks for the errorString() tip--I didn't know about that, it's helped me get closer to a solution to my problem.
Matt