Exemple #1
0
int CSys::Echo( oexCSTRW x_pFmt )
{//_STT();
	if ( !x_pFmt )
		return 0;
	CStr8 s = oexStrWToStr( x_pFmt );
#if defined( oexUNICODE )
	CUtil::AddOutput( x_pFmt, s.Length(), oexTRUE );
#else
	CUtil::AddOutput( s.Ptr(), s.Length(), oexTRUE );
#endif
	return ::puts( s.Ptr() );
}
Exemple #2
0
int CSys::vPrint( oexCSTR8 x_pFmt, oexVaList pArgs )
{   //_STT();
    CStr8 s;
    s.vFmt( x_pFmt, pArgs );
    Echo( s.Ptr() );
    return s.Length();
}
Exemple #3
0
int CSys::Print( oexCSTR8 x_pFmt, ... )
{   //_STT();
    CStr8 s;
    oexVaList ap;
    oexVaStart( ap, x_pFmt );
    s.vFmt( x_pFmt, (va_list)ap );
    oexVaEnd( ap );
    Echo( s.Ptr() );
    return s.Length();
}
oexBOOL CVfsFtpSession::CmdPasv()
{
    oexBOOL bStarted = oexFALSE;

    // Loop through port numbers
    if ( m_uPasvPort >= 3900 )
        m_uPasvPort = 3110;

    while ( m_uPasvPort < 4000 && !bStarted )
    {
        // Next port
        m_uPasvPort++;

        // Ensure the thread is running
        if ( !m_nsData.IsRunning() )
            m_nsData.Start();

        // Reset server
        m_nsData.Queue( 0, oexCall( oexT( "Reset" ) ) );

        // Bind to port
        if ( m_nsData.Queue( 0, oexCall( oexT( "Bind" ), m_uPasvPort ) )
                .Wait( oexDEFAULT_TIMEOUT ).GetReply().ToInt()

             && m_nsData.Queue( 0, oexCall( oexT( "Listen" ), 0 ) )
                .Wait( oexDEFAULT_TIMEOUT ).GetReply().ToInt() )

            bStarted = oexTRUE;

    } // end while

    // Did we get a server?
    if ( bStarted )
    {
        // Tell the client where the server is
        CStr8 sAddress = oexStrToStr8( LocalAddress().GetDotAddress().Replace( '.', ',' ) );
        Write( CStr8().Fmt( "227 Entering Passive Mode (%s,%u,%u).\n",
                            sAddress.Ptr(), m_uPasvPort >> 8 & 0xff, m_uPasvPort & 0xff ) );
    } // end if

    else