Logo Search packages:      
Sourcecode: znc version File versions

template<class T>
bool TSocketManager< T >::Connect ( const CSConnection cCon,
T *  pcSock = NULL 
) [inline]

Create a connection

Parameters:
cCon the connection which should be established
pcSock the socket used for the connectiong, can be NULL
Returns:
true on success

Definition at line 1237 of file Csocket.h.

      {
            // create the new object
            if ( !pcSock )
                  pcSock = new T( cCon.GetHostname(), cCon.GetPort(), cCon.GetTimeout() );
            else
            {
                  pcSock->SetHostName( cCon.GetHostname() );
                  pcSock->SetPort( cCon.GetPort() );
                  pcSock->SetTimeout( cCon.GetTimeout() );
            }

            if( cCon.GetAFRequire() != CSSockAddr::RAF_ANY )
                  pcSock->SetAFRequire( cCon.GetAFRequire() );

            // make it NON-Blocking IO
            pcSock->BlockIO( false );

            // bind the vhost
            pcSock->SetBindHost( cCon.GetBindHost() );

#ifdef HAVE_LIBSSL
            pcSock->SetSSL( cCon.GetIsSSL() );
            if( cCon.GetIsSSL() )
            {
                  if( !cCon.GetPemLocation().empty() )
                  {
                        pcSock->SetPemLocation( cCon.GetPemLocation() );
                        pcSock->SetPemPass( cCon.GetPemPass() );
                  }
                  if( !cCon.GetCipher().empty() )
                        pcSock->SetCipher( cCon.GetCipher() );
            }
#endif /* HAVE_LIBSSL */

            pcSock->SetType( T::OUTBOUND );

            pcSock->SetConState( T::CST_START );
            AddSock( pcSock, cCon.GetSockName() );
            return( true );
      }


Generated by  Doxygen 1.6.0   Back to index