×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    24

    RE: Socket connection with 7650

    hi,
    Has anybody got Series60 Sockets example work?
    I am getting error 'Timeout -33'

    thanks
    -nitin gaur

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    2

    Socket connection with 7650

    Hi,

    I'm having difficulties with socket connections. I'm trying to connect from my 7650 phone to a server via normal sockets in a similar fachion with the Symbian Series 60 SDK examples. Here is my code:
    // Connect to socket server
    RSocketServ ss;
    TInt err=ss.Connect();
    User::LeaveIfError(err);


    // Open a socket
    err=iSocket.Open(ss, KAfInet, KSockStream, KProtocolInetTcp);
    console->Printf(_L("iSocket.Open() = %d\n&quot, err);
    User::LeaveIfError(err);

    // Bind the socket to a specific local port, this actuelly
    // isn't the same that shows up on the server end. Wonder why...
    err = iSocket.SetLocalPort(5034);
    console->Printf(_L("iSocket.setLocalPort() = %d\n&quot, err);

    // Make a connection
    TRequestStatus iStatus;
    iSocket.Connect(iAddress, iStatus); // iAddress holds the server name and connection port
    if (iStatus.Int() == KRequestPending)
    console->Printf(_L("Request is pending...\n&quot);
    else
    console->Printf(_L("Status: %d\n&quot, iStatus.Int());

    // Find out the local address
    TInetAddr localAddress;
    iSocket.LocalName(localAddress);
    TUint32 addr = localAddress.Address();
    int ip1 = addr >> 24;
    addr = addr - (ip1 << 24);
    int ip2 = addr >> 16;
    addr = addr - (ip2 << 16);
    int ip3 = addr >> 8;
    addr = addr - (ip3 << 8);
    console->Printf(_L("ip: %d.%d.%d.%d port: %d\n&quot, ip1, ip2, ip3, addr , localAddress.Port());

    // Wait for connection
    int t = User::TickCount();
    while ((User::TickCount() - t) < 1000 && iStatus == KRequestPending) {
    }

    // Do a HTTP get
    TBuf8<256> writeBuffer(_L8("GET /do/something HTTP/1.1\nHost: 127.0.0.1\n\n&quot);
    TSockXfrLength aLength(56);
    iSocket.Send(writeBuffer, KIpDontFragment, iStatus, aLength);
    if (iStatus.Int() == KErrNotReady)
    console->Printf(_L("Not ready\n&quot);
    else
    console->Printf(_L("Status: %d\n&quot, iStatus.Int());

    // Read response
    iSocket.RecvOneOrMore(iDataBuffer, 0, iStatus, iRecvLen);
    console->Printf(_L("Received: %d\n&quot, iRecvLen);
    if (iStatus.Int() == KErrNotReady)
    console->Printf(_L("Not ready\n&quot);
    else
    console->Printf(_L("Status: %d\n&quot, iStatus.Int());
    console->Printf(_L("Done.\n&quot);

    iSocket.Close();
    ss.Close();

    The problem here is that the connection is established, but the phone doesn't seem to relize it. In this case when I set my own timer to less than timeout, the write and read methods return Not Ready. When I increase my own counter to more than the timeout value, they return Timeout. I followed the packet stream to analyze the discussion of server and phone. Here are my findings as TCP stream (SYN = Synchronize, ACK = Acknowledge):

    1. The phone send a SYN to the server
    2. Server responses with ACK and it's own SYN
    3. Phone responses with ACK to the servers SYN

    According to RFC specifications of TCP protocol this is when the connection is regarded as established, which is seen on the server side. But the next packet from phone is a SYN-packet instead of a normal data package. So the phone starts everything all over again. This is when the packet stream gets messy and sometimes the server calls for RES (reset) and sometimes the phone does it also.

    The emulator didn't even do that much.

    I also tried the Series 60 Sockets example but with no luck. So I'm asking is has ANYONE got the sockets working on the actual phone? If so, I would be more than happy to see that code and probably get a description about how it works. Or even get succestions for changes in the code.

    Thanks in advance,
    Tapio

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    53

    RE: Socket connection with 7650

    Hi,
    i'm interested of the same issue.I've some problems in running the Socket example on the emulator because i've an error message like error -33timeout. In this way the connection is refused, if you solved the problem of running Socket example can you help me?
    Thanks in advace.
    Best regards.

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

    RE: Socket connection with 7650

    Hi,

    Let me quote from a letter found at Forum Nokia - Symbian - Symbian Tools & SDKs :
    ---- Quotation begins
    Dear Developers,

    I have now talked with the people at Degel Software Ltd about publishing their modified cdbv2.dat file and they agreed.

    So, to get RAS working with the 0.9 SDK, please download the cdbv2.dat file at:

    http://www.digstud.se (Choose Symbian to the left)

    I think everyone interested in making network-enabled-software will appreciate the efforts that David Jacobson at Degel Software put into this issue. (http://www.degel.com)

    And again, I hope that Nokia will provide a working toolkit for the next release.

    Best Regards,
    /Patrik Strmstedt
    patrik@digstud.se
    ---- Quotation ends

    I downloaded that comms db and it works!

    tOtE

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

    RE: Socket connection with 7650

    Hi,

    Let me quote from a letter found at Forum Nokia - Symbian - Symbian Tools & SDKs :
    ---- Quotation begins
    Dear Developers,

    I have now talked with the people at Degel Software Ltd about publishing their modified cdbv2.dat file and they agreed.

    So, to get RAS working with the 0.9 SDK, please download the cdbv2.dat file at:

    http://www.digstud.se (Choose Symbian to the left)

    I think everyone interested in making network-enabled-software will appreciate the efforts that David Jacobson at Degel Software put into this issue. (http://www.degel.com)

    And again, I hope that Nokia will provide a working toolkit for the next release.

    Best Regards,
    /Patrik Strmstedt
    patrik@digstud.se
    ---- Quotation ends

    I downloaded that comms db and it works!

    tOtE

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

    RE: Socket connection with 7650

    Yes I've gotten sockets to work, both in the emulator and on a real phone. I still have some problems with sudden KErrAbort.

    I just checked you code briefly and all the examples I have seen are built as CActive objects. You don't have to use them, but in a GUI model it fits.

    The thing I observed in your code is that you seem to miss a:
    User::WaitForRequest(iStatus);
    after each recv or send.

    /Patrik

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

    RE: Socket connection with 7650

    So,

    You have problems with sockets both on the emulator and the hw. Well, unfortunately I cannot tell you the perfect solution, I can only give you some advices.

    First, I don't know this setupcomms.bat, but I would have used commsdb_ras.cmd instead. This way, you get a comms db set up for RAS communication. After executing this batch file, I would replace the comms db (cdbv2.dat) by the one suggested by Patrik. After this, the RAS should work.

    Hw : when you tell your socket to connect to a remote host, the system (the socket server?) first checks whether there's already an active connection. If there is, then it uses that connection. If there isn't, then it pops up a dialog containing the available access points (APs) and you can (and must) choose from them.
    AFAIK, it's possible to specify the characteristics of the AP to be used by code (so you needn't choose an AP from the list manually). This can be done by using the default AP from the comms db. If the settings of the default AP don't satisfy your needs, then you're free to modify them by using the RGenericAgent class in agentclient.h. This way, you can override the important settings. Note : I haven't used this class yet, but I'm planning to use it.

    Hope it helps,

    tOtE

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

    RE: Socket connection with 7650

    The example "Sockets" in Symbian/6.1/Series60/Series60Ex/Sockets can be used as a simple telnet program using null modem cable connected to COM1 for dial out by emulator and COM2 for accept incoming connection by RAS.

    You have to replace cdbv2.dat which is provided by tote.

    Just make sure that same baud rate is used for COM1 and COM2.

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

    RE: Socket connection with 7650

    The example in Symbian/6.1/Series60/Series60Ex/Sockets can be used as a simple telnet program using null modem cable connected to COM1 for dial out by emulator and COM2 for accept incoming connection by RAS.

    You have to replace cdbv2.dat which is provided by tote.

    Just make sure that COM1 and COM2 are configure the same baud rate if you are using NULL modem cable.

  10. #10
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    53

    RE: Socket connection with 7650

    Hi,
    i'm tryng to modify the socket example in a way that i can fix the accesss point with the configuration of the GPRS APN i'd like to use.
    I don't know where in the socket framework the calling to the RGenericAgentClass is. I understood that RGenericAgentClass take the information from the commsdB. In a real HW phone the application allows us to choose among the connection setting(the commmsdB of the phone i image).So if i know where this calling is i can use a function of RGenericAgentClass like:
    TInt StartOutgoing(CStoreableOverrideSettings& aOverrides)
    This function can overwrite the settings and open a specified APN.
    At this point the socket application used the APN opened.
    It is correct?
    Thanks in advance

  11. #11
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    102

    RE: Socket connection with 7650

    I use the example sockets in series60ex.It also failed.And i use socket bench to listern the port 80.It told me:"connection failed by time out or other error.And I can use webview.And some one run the example well.so i thinks the wrong is in GateWay.Do you have any advices?Thanks.

Posting Permissions

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