Jump to content

HELP ME - socket error in linux

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
donzaza

donzaza

    Newbie

  • Members
  • Pip
  • 1 posts
Hi guys

i have a really big problem.
Well, i have a server-client software written by university friends using qt4.4.

In the server we have this connect
QObject::connect(socketTcpIp, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectionerror(QAbstractSocket::SocketError)));
}

void Server::connectionerror(){
    qDebug(" Plug out the ethernet cable");
    
} 

well, the problem is with the SIGNAL.
Under Windows Xp, when I plug out the cable the signal is normally emitted,
but under linux (tried on gentoo and ubuntu) noting happens(the signal is not emitted).
I did some checks under my linux box, and I saw that plugging out the cable the socket is not closet by operating system(netstat -a say this).
Then, if I plugged in the cable again, the connection become restored.

Really thanks

Edited by Jaan, 20 September 2008 - 02:23 PM.
Please use code tags when you're posting your codes!


#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I have never used qt4 to work with sockets, but I have used the header files provided with the linux operating system (sys/socket.h). Now I could be wrong, but Linux uses file descriptors to handle sockets. When you don't close the socket, but calling the close() function, the file descriptor still remains in the kernal for a few minutes, and because of this, Linux still thinks you are connected.