×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    KERN EXEC on Socket Opening?

    My code is as follows:

    Code:
    void CConnection::ConnectL()
    {
    
    	iState = EConnecting;
    
    	User::LeaveIfError( iSocket.Open( iSocketServer, KAfInet, KSockStream, KProtocolInetTcp ) );
    
    	// Set port
    	destAddr.SetFamily(KAfInet);
    	destAddr.SetAddress(INET_ADDR(131,204,27,5)); 
    	destAddr.SetPort(5000); 
    
    	iSocket.Connect(destAddr,iStatus);	
    
    	#ifdef __WINS__
        User::After( 1 );     // Fix to allow emulator client to connect to server
    	#endif
    
    	SetActive();
    }
    Debugging tells me that the:
    User::LeaveIfError( iSocket.Open( iSocketServer, KAfInet, KSockStream, KProtocolInetTcp ) );

    Throws a KERN-EXEC 3 error.

    From this snippet, is there anything that jumps out at you guys that could be the cause?

    Thanks!

  2. #2
    Regular Contributor
    Join Date
    May 2007
    Posts
    468

    Re: KERN EXEC on Socket Opening?

    Connected to socket sorver?

    Jack

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    Re: KERN EXEC on Socket Opening?

    Quote Originally Posted by Jack Torrance View Post
    Connected to socket sorver?

    Jack
    Sure enough, in my constructor I have this:

    void CConnection::ConstructL()
    {
    User::LeaveIfError( iSocketServer.Connect() );
    ...

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: KERN EXEC on Socket Opening?

    Can it happen that you also Close it?
    Have you got multiple threads?
    Which SDK do you use? If it is a 2nd edition SDK, does the issue happen in a GUI or a console-based project?

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    Re: KERN EXEC on Socket Opening?

    Quote Originally Posted by wizard_hu_ View Post
    Can it happen that you also Close it?
    Have you got multiple threads?
    Which SDK do you use? If it is a 2nd edition SDK, does the issue happen in a GUI or a console-based project?


    Happens at both. I've modified the code now, here is the class in full:

    http://dev.jodynichols.com/seniordes...Connection.cpp
    http://dev.jodynichols.com/seniordes...e/Connection.h


    If you wanted to look I would appreciate it immensely. Its not a lot of code so it probably won't take long to find the problem.

    I now am getting a ESOCK Client Error 23. I don't see anything being closed though.

    And this is the 3rd edition SDK and i've tried both a Console and GUI approach.

    EDIT: Keep in mind this is barebones code. I will implement more functionality and control as I go, I just want to get this connection going to prove it works before I continue on.
    Last edited by nichojo; 2008-02-12 at 18:23.

  6. #6
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: KERN EXEC on Socket Opening?

    Khm, in your actual code you use RConnection. Somehow you have forgot to mention this in previous posts. However you apparently Open and Start it.
    Some minor suggestions could be
    - the use of "const TDesC&" instead of "TBuf<256> &"
    - iDestAddr instead of destAddr
    May I ask how you instantiate and use CConnection?

  7. #7
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    Re: KERN EXEC on Socket Opening?

    Quote Originally Posted by wizard_hu_ View Post
    Khm, in your actual code you use RConnection. Somehow you have forgot to mention this in previous posts. However you apparently Open and Start it.
    Some minor suggestions could be
    - the use of "const TDesC&" instead of "TBuf<256> &"
    - iDestAddr instead of destAddr
    May I ask how you instantiate and use CConnection?

    I added that RConnection a few hours ago as a test to see if that was I was missing.

    In the console app main I use:


    CConnection * iConnection;

    and

    TRAPD(connError, iConnection->ConnectL());
    if (connError)
    return connError;


    Wizard, thank you so much for your help. I really appreciate it.

    EDIT: This is for the console app.
    Last edited by nichojo; 2008-02-12 at 19:24.

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: KERN EXEC on Socket Opening?

    Quote Originally Posted by nichojo View Post
    CConnection * iConnection;

    and

    TRAPD(connError, iConnection->ConnectL());
    if (connError)
    return connError;
    None of these lines show how you instantiate the class.

    But OK, here is my version: if you instantiate the class with new(ELeave), but you forget invoking ConstructL, your initial iState would be EAuthenticating, thus the (iState == EDisconnected) block is skipped, so the very first occasion where anything bad can happen is the iSocket.Open. And actually the bad thing happens.

  9. #9
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: KERN EXEC on Socket Opening?

    Beware of the control flow.. for instance, a quick look at your code shows a missing SetActive() after starting the RConnection, and of course the rest of the code relying on that RConnection should be called after RunL() is invoked. As a first test, I'd try to reduce the code instead of adding new things like the RConnection.

    Make sure the async request is completed before issuing further requests..

    Also, as wizard stated, beware of scope issues when using async functions (ie. avoid automatic vars)

  10. #10
    Registered User
    Join Date
    Jan 2008
    Posts
    20

    Re: KERN EXEC on Socket Opening?

    Quote Originally Posted by PushL View Post
    Beware of the control flow.. for instance, a quick look at your code shows a missing SetActive() after starting the RConnection, and of course the rest of the code relying on that RConnection should be called after RunL() is invoked. As a first test, I'd try to reduce the code instead of adding new things like the RConnection.

    Make sure the async request is completed before issuing further requests..

    Also, as wizard stated, beware of scope issues when using async functions (ie. avoid automatic vars)
    Thanks! I've redone some things and I think things might be working. I will implement your instructions now.

Similar Threads

  1. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  2. why kern exec 3 on CopyFile?
    By flicker82 in forum Symbian
    Replies: 2
    Last Post: 2005-05-16, 02:25
  3. Problem opening Server Socket?
    By camroe in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2005-03-02, 22:27
  4. Opening socket connection fails
    By Hardcoreprogrammer in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2005-01-17, 08:37
  5. opening a socket connection
    By bhatti81 in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2003-07-16, 10:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×