×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    14

    http download via gprs and RSocket

    Hello

    Do you have any example code for using a GPRS connection to the internet?

    What I'm trying to do is to download a file via http and gprs from a certain server. Unfortunately I cannot use the HttpRequest API because I'm using a Nokia 7650 which is compatible only with SDK 1.2 (OS ver 6.1) and it's not supported.

    I'd like to do this using RSocket ,the TCP/IP protocol and HTTP commands but I'm new Symbian communications programming and I can't seem to be able to connect ot the server and send it some data.

    I've found a sample for using sockets and tcp/udp connections for the Nokia 9210 (series 80) but it doesn't work for me.

    I've created a small server that listens on port 4500 and used it to test this. The server works great but my client here does not.

    Here is the code I used to try to connect (the client).
    Any help is appreciated. Thanks

    trh() and tr() are trace functions I use for debugging

    int TestConnection::ConnectL()
    {
    //4294967260 ffff.ffdc -36 KErrDisconnected
    //4294967267 ffff.ffe3 -29 KErrCommsLineFail
    TInetAddr iAddress;
    RSocket iSocket;
    RSocketServ iSocketServ;
    TRequestStatus iStatus;

    // Open channel to Socket Server
    User::LeaveIfError(iSocketServ.Connect());
    // Open a TCP socket
    User::LeaveIfError(iSocket.Open(iSocketServ, KAfInet, KSockStream, KProtocolInetTcp));
    // Connect to an Echo Socket by IP address
    iAddress.SetPort(4500);
    // iAddress.SetAddress(0x50606872); //address 80.96.104.114
    TUint32 KInetAddr = INET_ADDR(80,96,104,114);
    iAddress.SetAddress(KInetAddr); //address 80.96.104.114
    iSocket.Connect(iAddress, iStatus);
    User::WaitForRequest(iStatus);
    trh("istatus",iStatus.Int()); //0x80000001 - KRequestPending
    iSocket.Send(_L8("COMMAND FROM PHONE 111"),0,iStatus);
    trh("istatus",iStatus.Int()); //0x80000001 - KRequestPending
    User::WaitForRequest(iStatus);
    trh("istatus",iStatus.Int()); //0x80000001 - KRequestPending
    iSocket.Send(_L8("COMMAND FROM PHONE 222"),0,iStatus);
    trh("istatus",iStatus.Int()); //0x80000001 - KRequestPending
    User::WaitForRequest(iStatus);
    trh("istatus",iStatus.Int()); //0x80000001 - KRequestPending
    TBuf8<255> buf;
    iSocket.Recv(buf,0,iStatus);
    trh("istatus",iStatus.Int()); //0x80000001 - KRequestPending
    User::WaitForRequest(iStatus);
    tr("data receveid:");tr(buf.PtrZ());
    trh("istatus",iStatus.Int()); //0x80000001 - KRequestPending
    iSocket.Close();
    trh("istatus",iStatus.Int()); //0x80000001 - KRequestPending
    iSocketServ.Close();

    return 0;
    }

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    You better look at "sockets" example in SDK. It can be used as a good basis for the kind of things you want develop...

    Also search this forum for stuff like "socket", "http get", etc... It was discussed many times here and you even can find complete examples.

    I just quickly searched for one:

    http://discussion.forum.nokia.com/fo...5&pagenumber=2

    but you can find more.

Posting Permissions

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