Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Registered User soni_neeraj's Avatar
    Join Date
    Feb 2008
    Posts
    195
    Hi Expert,
    I am getting error KErrAbort (error code -39) when creating ssl connection , am using WikiSecureSocketEx.zip example for reference .



    Please Help as soon as.

    Looking forward positive response.

  2. #2
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,664
    in general, you should provide a link to the original source, that way somebody could actually try understanding what you are doing.

    Also, if you made any changes to any parts of code, you should really mention that.

    also which platform you are building, and with which tools.

    And you should mention whether you get this error in emulator, or in device (please also specify the device used)

    And also it might help, if you could specify the line of code which after you get this error.

  3. #3
    Registered User soni_neeraj's Avatar
    Join Date
    Feb 2008
    Posts
    195
    Hey Yucca,

    I ma getting error at line User::LeaveIfError(iStatus.Int()); in below function called.

    void CSecureSocketCore::MakePageRequestL() KErrNone
    {
    // The secure connection has now been made.
    // Send a get request for the page.
    User::LeaveIfError(iStatus.Int());

  4. #4
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,664
    that part of code does not make any sense really.. Basically you would need to undestand teh code first, I assume that you have active object there, and you make a reguest, and then your RunL gets called.

    when the RunL is called, then the iStatus.Int() would indicate possible error codes, so do see how you get to this function, and what is done there.

    Then again, what else would be in this particular function ?

  5. #5
    Registered User soni_neeraj's Avatar
    Join Date
    Feb 2008
    Posts
    195
    Hi Yucca Thanks, i added iSecureSocket->SetOpt(KSoSSLDomainName, KSolInetSSL, serverName);
    after creating securesocket and now it is making connection and requesting for data but still
    not able to open the web page.
    iRcvBuffer.Length() is coming 0.
    void CSecureSocketCore::ReadServerResponseL()
    {
    // Any error other than KErrEof means the test is a failure
    if (iStatus!=KErrEof) User::LeaveIfError(iStatus.Int());

    // Put the received data in the output file & reset the receive buffer
    iTotalBytesRead += iRcvBuffer.Length();

    // Case 1: error is KErrEof (message complete) or no data received, so stop
    if ( ( iStatus==KErrEof ) || ( iRcvBuffer.Length() == 0 ) )
    {

    // Close the socket neatly
    iState = EStopping;
    iTimer.After( iStatus, 1000000 );
    return;
    }

  6. #6
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,664
    Basically you would need to debug the codes, and see what is happening, and what is not. And as the problem is with data, so check that your other-end is indeed functioning OK as well, and the data is sent from there accordingly.

    Also you should descipe problems in more details, the code does not have any reference to Web Browsers, so saying but still not able to open the web page. sound a bit confusing to me.

  7. #7
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,680
    Quote Originally Posted by soni_neeraj View Post
    Hi Yucca Thanks, i added iSecureSocket->SetOpt(KSoSSLDomainName, KSolInetSSL, serverName);
    That requires some elevated capability (perhaps WriteDeviceData) if I remember correctly. Have you checked its result code? Is it KErrNone?

  8. #8
    Registered User soni_neeraj's Avatar
    Join Date
    Feb 2008
    Posts
    195
    [B]but still not able to open the web page[/B] means : after connecting the socket , am trying to open web sit using that connection

  9. #9
    Registered User soni_neeraj's Avatar
    Join Date
    Feb 2008
    Posts
    195
    Yes yucc , i am using WriteDeviceData capability, and i debug the code ,

    the call flow of code is according to callback is below
    ConnectL
    MakeSecureConnectionL
    MakePageRequestL
    GetServerResponseL
    ReadServerResponseL ->.> we are getting length code is 0 here :

    below is the source code of example code:


    /*
    ============================================================================
    Name : SecureSocketCore.cpp
    based on : http://www.symbian.com/developer/tec...SSLExampleCode
    Author : Konstantine; Company: Fishnest Ukraine Sebastopol
    Version :
    Support : bluspan@gmail.com
    Description : CSecureSocketCore implementation
    ============================================================================
    */

    #include "SecureSocketCore.h"

    // HTTP messages
    _LIT8(KSimpleGet, "GET");
    _LIT8(KNewLine, "\n");

    CSecureSocketCore::CSecureSocketCore() : CActive( EPriorityStandard ), iSndBuffer(0,0), iRcvBuffer(0,0)
    {
    }

    CSecureSocketCore* CSecureSocketCore::NewLC()
    {
    CSecureSocketCore* self = new ( ELeave ) CSecureSocketCore();
    CleanupStack::PushL( self );
    self->ConstructL();
    return self;
    }

    CSecureSocketCore* CSecureSocketCore::NewL()
    {
    CSecureSocketCore* self = CSecureSocketCore::NewLC();
    CleanupStack::Pop(); // self;
    return self;
    }

    void CSecureSocketCore::ConstructL()
    {
    //== konstantine_entrance : mycode myinitialization
    iPort = 443;
    //iPort = 5222;
    User::LeaveIfError( iSocketServer.Connect() );
    iSndBuffer.Set((TUint8*)User::AllocL(256),0,256);
    iRcvBuffer.Set((TUint8*)User::AllocL(256),0,256);

    //== <- my
    User::LeaveIfError( iTimer.CreateLocal() ); // Initialize timer
    CActiveScheduler::Add( this ); // Add to scheduler
    }

    CSecureSocketCore::~CSecureSocketCore()
    {
    Cancel(); // Cancel any request, if outstanding
    iTimer.Close(); // Destroy the RTimer object
    delete (void*)iSndBuffer.Ptr();
    delete (void*)iRcvBuffer.Ptr();
    //CActiveScheduler::Stop();
    // Delete instance variables if any
    }

    void CSecureSocketCore:oCancel()
    {
    iTimer.Cancel();
    }

    void CSecureSocketCore::StartL( TTimeIntervalMicroSeconds32 aDelay )
    {
    Cancel(); // Cancel any request, just to be sure
    //iState = EUninitialized;
    iState = EMakingSecureConnection;
    iTimer.After( iStatus, aDelay ); // Set for later
    SetActive(); // Tell scheduler a request is active
    }

    void CSecureSocketCore::RunL()
    {
    if ( iState == EMakingSecureConnection) {
    MakeSecureConnectionL();
    iState = EMakingPageRequest;
    iRBufConsoleObserver->AppendToConsole(_L("Making Secure Connection\n"));
    }
    else if ( iState == EMakingPageRequest) {
    MakePageRequestL();
    iState = EGettingServerResponse;
    iRBufConsoleObserver->AppendToConsole(_L("Making Page Request\n"));
    }
    else if ( iState == EGettingServerResponse) {
    GetServerResponseL();
    iState = EDataReceived;
    iRBufConsoleObserver->AppendToConsole(_L("Get Server Response\n"));
    }
    else if ( iState == EDataReceived) {
    ReadServerResponseL();
    }
    else if ( iState == EStopping) {
    ConnectionStop();
    iState = EStopped;
    iRBufConsoleObserver->AppendToConsole(_L("Stop Connection\n"));
    iRBufConsoleObserver->ShowConsole();
    }
    else if ( iState != EError )
    {
    // Do something
    }
    //iTimer.After( iStatus, 1000000 ); // Set for 1 sec later
    if (iState != EStopped)
    SetActive(); // Tell scheduler a request is active
    }

    TInt CSecureSocketCore::RunError( TInt aError )
    {
    return aError;
    }

    // ---! Secure connection !---

    void CSecureSocketCore::ConnectL()
    {
    iSndBuffer.SetLength( 0 );
    iRcvBuffer.SetLength( 0 );
    iTotalBytesRead = 0;

    // _LIT( KIPAddress, "63.245.209.11");
    _LIT( KIPAddress, "195.211.49.6");
    // _LIT( KIPAddress, "o.nimbuzz.com");

    // _LIT( KIPAddress, "195.211.49.18");


    // 192.168.58.135
    // _LIT( KIPAddress, "209.207.221.16");
    //195.211.49.6
    // 209.207.221.16
    // _LIT( KIPAddress, "192.168.58.135");



    // 195.211.49.16
    // 195.211.49.6
    //==konstantine_entrance : mycode
    // from Chat example

    TInetAddr addr;
    TUint32 aAddr;

    iState = EMakingSecureConnection;

    if ( addr.Input( KIPAddress ) == KErrNone )
    {
    // server name is already a valid ip address
    aAddr = addr.Address();
    iAddress.SetPort( iPort );
    iAddress.SetAddress( aAddr );

    iAddress.SetFamily( KAfInet );

    // Open a TCP socket
    User::LeaveIfError( iSocket.Open( iSocketServer,
    KAfInet,
    KSockStream,
    KProtocolInetTcp ) );

    // Initiate socket connection
    iSocket.Connect( iAddress, iStatus );
    SetActive();
    //CActiveScheduler::Start();
    //User::LeaveIfError(iStatus.Int()); // errors caught by RunError()
    }
    }

    void CSecureSocketCore::MakeSecureConnectionL()
    {
    User::LeaveIfError(iStatus.Int()); // errors caught by RunError()
    TBufC8<32> servername(_L8("195.211.49.6"));
    // TBufC8<32> servername(_L8("195.211.49.18"));
    // TBufC8<32> servername(_L8("o.nimbuzz.com"));
    // TBufC8<32> servername(_L8("63.245.209.11"));

    //



    // iTlsSocket = CSecureSocket::NewL( iSocket, _L("SSL3.0"));
    iTlsSocket = CSecureSocket::NewL( iSocket, _L("SSL3.0"));
    iTlsSocket->SetOpt(KSoSSLDomainName, KSolInetSSL, servername);

    iTlsSocket->FlushSessionCache();

    // start the handshake
    iTlsSocket->StartClientHandshake( iStatus );

    //SetActive();
    }

    void CSecureSocketCore::MakePageRequestL()
    {
    /* // The secure connection has now been made.
    // Send a get request for the page.
    User::LeaveIfError(iStatus.Int());

    // _LIT8( KPage , "https://mozilla.org");
    _LIT8( KPage , "https://nimbuzz.com");

    // Create a GET request
    iSndBuffer+=KSimpleGet;
    iSndBuffer+=KPage();
    iSndBuffer+=KNewLine;

    // Send the request
    iTlsSocket->Send( iSndBuffer, iStatus, iBytesSent );*/

    User::LeaveIfError(iStatus.Int());
    _LIT8( KPage,"http://www.nimbuzz.com");
    // Create a GET request
    iSndBuffer+=KSimpleGet; // "GET "
    iSndBuffer+=KPage();
    iSndBuffer+=KNewLine; // "\n"
    // Send the request
    iTlsSocket->Send( iSndBuffer, iStatus, iBytesSent );
    }

    void CSecureSocketCore::GetServerResponseL()
    {
    // The get request has been sent, can now try and receive the data
    User::LeaveIfError(iStatus.Int());

    TBuf8<2> buf;
    User::LeaveIfError(iTlsSocket->CurrentCipherSuite( buf ));

    // Print the protocol version string
    TBuf<32> protocol;
    User::LeaveIfError(iTlsSocket->Protocol( protocol ));

    // Print info about the server's certificate
    const CX509Certificate *servCert = iTlsSocket->ServerCert();

    // Read asynchonously-returns when buffer full
    iTlsSocket->Recv( iRcvBuffer, iStatus );
    }

    void CSecureSocketCore::ReadServerResponseL()
    {
    // Any error other than KErrEof means the test is a failure
    if (iStatus!=KErrEof) User::LeaveIfError(iStatus.Int());

    // Put the received data in the output file & reset the receive buffer
    iTotalBytesRead += iRcvBuffer.Length();

    // Case 1: error is KErrEof (message complete) or no data received, so stop
    if ( ( iStatus==KErrEof ) || ( iRcvBuffer.Length() == 0 ) )
    {

    // Close the socket neatly
    iState = EStopping;
    iTimer.After( iStatus, 1000000 );
    return;
    }

    // Case 2: there's more data to get from the server
    iRcvBuffer.SetLength( 0 );
    iState = EDataReceived;
    iTlsSocket->Recv( iRcvBuffer, iStatus );
    }

    void CSecureSocketCore::ConnectionStop()
    {
    iSocket.CancelAll();
    iTlsSocket->CancelAll();
    iTlsSocket->Close();
    delete iTlsSocket;
    //iTlsSocket =0;
    iSocket.Close();

    //Cancel();
    //iTimer.Cancel();
    iSocketServer.Close();

    //CActiveScheduler::Stop();
    User::After( 1000000 );
    }

    void CSecureSocketCore::SetRBufConsoleObserver(CRBufConsoleObserver *aObserver)
    {
    iRBufConsoleObserver = aObserver;
    }

    //== <- my

  10. #10
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,680
    KErrAbort comes because the server name you set in that SetOpt is probably incorrect, I do not think that it can be an IP number. 195.211.49.6 seems to correspond to nimbuzz.com, so try that name.
    Otherwise what you create in MakePageRequestL is not a valid HTTP(S) request. The "http://host" is not part of the request, but the protocol version is. Check the related RFC or at least the simple examples on Wikipedia.

  11. #11
    Registered User soni_neeraj's Avatar
    Join Date
    Feb 2008
    Posts
    195
    Thanks for ur reply:: i am getting same errro by using CSecuresocket example from wikipedia.

  12. #12
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,680
    There are no CSecureSocket examples on Wikipedia. Also, I was talking about the HTTP part, http://en.wikipedia.org/wiki/HTTP#Request_message, the messaging part is the same for HTTPS.
    Anyway, the HTTP part is not relevant as long as the connection can not be established. If nimbuzz.com or similar attempts do not work, you can try visiting the address from a regular browser (https://195.211.49.6/) and checking its certificate, that may help.

  13. #13
    Registered User soni_neeraj's Avatar
    Join Date
    Feb 2008
    Posts
    195
    Hi Am talking about WikiSecureSocketEx example.: it is also not working

  14. #14
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,680
    It can not work if the SetOpt does not match with the server certificate.

  15. #15
    Registered User soni_neeraj's Avatar
    Join Date
    Feb 2008
    Posts
    195
    so pls tell me how dose it match?

Page 1 of 2 12 LastLast

Similar Threads

  1. Error in creating HTTP connection
    By akash_rawat in forum Mobile Java General
    Replies: 1
    Last Post: 2009-10-25, 13:10
  2. KErrAbort Error in UDP Socket
    By muaz111111 in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2008-02-19, 13:36
  3. where can I get the error code of socket connection?
    By robert_lzw in forum Symbian C++
    Replies: 2
    Last Post: 2007-02-09, 07:52
  4. Socket connection not returning error code!
    By jestyjames in forum Symbian C++
    Replies: 1
    Last Post: 2005-02-27, 11:15
  5. error when creating GPRS connection
    By kenny2304 in forum Nokia M2M
    Replies: 3
    Last Post: 2004-11-11, 05:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved