×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    18

    Accept() call from the RSocket class.

    hi ,

    i'm new to symbian and i'm certainly trying to play with the methods in the RSockets classes for my TCP listener ...

    i'll tell u what exactly i am doing..all my method calls are from the RSockets class are in the foll sequence..

    1. Open() method to create a blank socket
    2. Bind() method used to bind to port (7030 in my case).
    3. Listen() method to specify no. of client allowed to connect.
    4. Accept() method to marry the incoming socket to the blank socket which'll be passed as a parameter to the Accept() method.

    It works perfectly fine uptil after the Accept() call...and then it gives me a App.Closed panic error 17. I also checked out the error codes and error 17 says - No Sockets currently open.

    I dunno if my Accept call is right...coz the Accept(RSocket& aBlankSocket) takes an RSocket (addressOf)object as a parameter and the docs clearly says..it shud be an blank socket..so i make use of the Open(RSocketServ& aServer) using an RSocket obj and pass it as a parameter to the Accept() call...I wonder if this is correct...???

    dunno where i am doing wat wrong...??
    Am also adding my listener method...

    Quote : *********************************

    void CSocketsEngine::Listen() // <a name="ConnectL32">
    {
    //Initiate attempt to connect to a socket by IP address
    if (iEngineStatus == ENotConnected)
    {
    //Open a TCP socket

    User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp));
    //Binding to port 7030
    TUint portNum = 7030;
    TSockAddr tsaPort;
    tsaPort.SetPort(portNum);
    TInt bindStat = iSocket.Bind(tsaPort);

    if (bindStat == KErrNone) {
    TBuf8<10> stat;
    _LIT8(kStat,"%d");
    stat.Format(kStat,bindStat);
    iConsole.ErrorNotify(_L("Bind Success"), iEngineStatus);
    }

    //Listening for socket connections
    TUint queSize = 5;
    TUint popConn;
    iConsole.ErrorNotify(_L("Before Listen Call"), iEngineStatus);
    popConn = iSocket.Listen(queSize);
    TBuf8<5> statListen;

    _LIT8(kstatListen,"%d");
    statListen.Format(kstatListen,popConn);
    iConsole.ErrorNotify(_L("Listen QueSize Set"), iEngineStatus);


    //Accept every connection as and when it comes in from the
    //listen call..


    RSocket blankRSock;
    TInt blsock = 0;
    blsock = User::LeaveIfError(blankRSock.Open(iSocketServ));

    TRequestStatus reqStat(blsock);
    iSocket.Accept(blankRSock,reqStat);
    TBuf8<20> inData;
    inData.Zero();

    TRequestStatus connStat;
    if (reqStat == KErrNone) {
    iConsole.ErrorNotify(_L("After Accept..."), iEngineStatus);
    }
    blankRSock.Read(inData,reqStat);
    iConsole.ErrorNotify(_L("The incoming value "), iEngineStatus);


    }
    }


    UnQuote : *******************************

    the code compiles fine...but gives the app closed panic 17 error at run time. I'd be happy happy happy if any o u cud give me any leads regarding this.

    thanks,
    adios,
    LearningCurve.

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    22

    panic 17

    hi

    i have the same problem. please let me know if you succeeded resolving it
    Last edited by ovacin; 2003-10-20 at 08:38.

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    10

    help

    Hi!

    I was wondering how u were able to connect the emulator to the internet. I have read lots of tutorials on how to do this but all of them require at least a NULL modem.

    Have any of you managed to do this only by software?

    Hope u can help me.

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    22

    emu to inet

    hi mmorphi,

    look to www.newlc.com
    you need a special tool to acchieve it callled vspdxp.exe
    there is a trial version to get

    read deailed info at http://www.newlc.com/article.php3?id_article=93

    i hope it works for you

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    22

    panic 17

    hi

    can someone tell me why use of CActive for blank socket-read doesn`t function. When i call

    User::WaitForRequest(iStatus); // Wait for completion of blankRSock.Read

    everything is all right but when i set the object active panic 17 occurs

    is there a way to solve it

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    30

    You do not use asynchronous services properly

    Hi,

    RSocket::Listen and RSocket::Bind are synchronous services. You don't have to use req. status when calling these methods. Note that you should pass a TInetAddr instead of a TSockAddr, because TSockAddr is for further derivation and TInetAddr is one of its successors.

    On the other hand, RSocket::Accept and RSocket::Read are asynchronous operations. What is missing then from your code? Well, I have not seen that you wait for the completion of your Accept call. That is the source of your problem : it is not enough to call Accept synchronously. Having Accept operation completed, you may issue the other asynchronous request, Read.

    Cheers,

    tOtE

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    16
    Did you find a working solution for this?

  8. #8
    Registered User
    Join Date
    Sep 2004
    Posts
    3

    TCP Listener anyone?

    Has anyone successfully implemented a socket server using the socket()
    bind()
    listen()
    accept() calls using the Symbian Rsocket class?

    I know that all the documentation available on Symbian / Series 60 SDK mentions that it works using Active Objects.

    However, like the original message above, the socket server implemeted on the cell phone / series 60 sdk emulator does not get any notification of an incoming connection request.

    So has anyone implemented the socket server application which accepts incoming connection requests on the cell phone? Or for that matter used the UDP call in the RSocket - RecvFrom successfully?

    Thanks,
    IR

Posting Permissions

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