Logo Search packages:      
Sourcecode: kmess version File versions  Download package

MsnSocketTcp::MsnSocketTcp ( ServerType  serverType  ) 

The constructor.

Initializes the sockets, buffers and ping timer.

Definition at line 59 of file msnsockettcp.cpp.

References slotConnected(), slotDisconnected(), slotHostFound(), slotLoginFailed(), slotSocketDataReceived(), and slotSocketError().

: MsnSocketBase( serverType )
, missedPings_( 0 )
, nextPayloadSize_( 0 )
, sendPings_( false )
{
  setObjectName( "MsnSocketTcp" );

  // Create the socket
  socket_ = new QTcpSocket( this );

  // TODO: socket timeout settings..

  // Forward the socket's raw event signals for further interpretation
  connect( socket_, SIGNAL(              connected() ),
           this,    SLOT  (          slotConnected() ) );
  connect( socket_, SIGNAL(           disconnected() ),
           this,    SLOT  (       slotDisconnected() ) );
  // Connect the socket's signals to parse them internally
  connect( socket_, SIGNAL(              hostFound() ),
           this,    SLOT  (          slotHostFound() ) );
  connect( socket_, SIGNAL(              readyRead() ),
           this,    SLOT  ( slotSocketDataReceived() ) );
  connect( socket_, SIGNAL(           error(QAbstractSocket::SocketError) ),
           this,    SLOT  ( slotSocketError(QAbstractSocket::SocketError) ) );
  connect( socket_, SIGNAL( proxyAuthenticationRequired(const QNetworkProxy&,QAuthenticator*) ),
           this,    SLOT  (           proxyAuthenticate(const QNetworkProxy&,QAuthenticator*) ) );

  // Connect the ping timer to the sendPing slot
  pingTimer_.stop();
  connect( &pingTimer_,       SIGNAL(         timeout() ),
           this,              SLOT  (    slotSendPing() ) );

  // Attach a timer to watch over the connection process
  connectionTimer_.stop();
  connectionTimer_.setSingleShot( true );
  connect( &connectionTimer_, SIGNAL(         timeout() ),
           this,              SLOT  ( slotLoginFailed() ) );

#ifdef KMESSTEST
  KMESS_ASSERT( socket_ != 0 );
#endif
}


Generated by  Doxygen 1.6.0   Back to index