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

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

Create a connection

Parameters:
sHostname the destination
iPort the destination port
sSockName the Socket Name ( should be unique )
iTimeout the amount of time to try to connect
isSSL does the connection require a SSL layer
sBindHost the host to bind too
bIsIPv6 set to true to connect to an ipv6 host, requires HAVE_IPV6 at compile time to work
Returns:
true on success

Definition at line 1199 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() );
            }
            pcSock->SetIPv6( cCon.GetIsIPv6() );

            // 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