×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 28
  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Question Open C and Opening connection

    Hi
    I decided to go with Open c to implement sockets , I wonder how to open connection using open c , How to mention Accesspoint Id? Or is it like if im using open C i dont have to worry about accespoints ? I had a look at article like this
    and the links mentioned in it , which doesnt any way give an idea about how to open a new connection by using the default accespoint. or how to prompt the accespoint list.
    http://www.developer.nokia.com/Commu..._an_IP_Address
    If any one has any clue about this please let me know-

    PS I wonder where is the Open c foru
    -J

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    India
    Posts
    1,173

    Re: Open C and Opening connection

    Quote Originally Posted by julie_777 View Post
    I wonder where is the Open c foru
    -J
    http://www.developer.nokia.com/Commu...p?137-Open-C-C
    Though it's a read only forum.

    Also, check http://www.developer.nokia.com/Commu...n_C_How_to%27s if it can help you.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Open C and Opening connection

    That is a really bad decision, Open C sockets are rather unreliable if you stress them (like having several connections come and go).
    Otherwise there is an extra API-set for managing access points, if you install the plug-in, they will be described in a separate .doc file. setdefaultif is the call for setting the access point programatically, and you can probably find some more, perhaps for listing too.

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: Open C and Opening connection

    Quote Originally Posted by wizard_hu_ View Post
    That is a really bad decision, Open C sockets are rather unreliable
    Indeed they are

  5. #5
    Registered User
    Join Date
    Jul 2011
    Posts
    20

    Re: Open C and Opening connection

    I just happend to see this thread, I was thinking of Using OpenC sockets instead of Symbian sockets , So is it really that unstable in comparison with native sockets?

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

    Re: Open C and Opening connection

    Generally you do not see what Open C is doing inside, so when your code starts dying you will have no idea about the cause. The Symbian error codes are hidden, and the POSIX error codes are less detailed, sometimes you only see success/failure. If the code really needs resources, like many sockets, threading, etc., it may silently run out of secret internal Open C limitations (message slots, etc.), which you do not even know about, and you definitely can not adjust.
    I was fighting with these issues in 2009, so things might have improved since then. For example Symbian^3 was open source for some time, and thus a version of Open C is available as source code now. Also, Qt builds on Open C/C++, that may also be some incentive to fix things (however it may happen that Qt uses Symbian sockets directly).

  7. #7
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Open C and Opening connection

    I tried this code
    int sock_fd;
    int retour;
    struct sockaddr_in serv_addr;

    sock_fd = socket(AF_INET, SOCK_STREAM, 0);

    serv_addr.sin_family = AF_INET;
    //serv_addr.sin_addr.s_addr = htonl((uint32_t)"194.164.14.110");
    serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
    serv_addr.sin_port = htons(80);

    retour = ::connect(sock_fd,(struct sockaddr*)&serv_addr,sizeof(serv_addr));

    which should open a connection or atleast popup for access point list but nothing happened all i got is retour is -1 , any idea about what is goin wrong here
    i tried socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); too no pop up!
    Last edited by julie_777; 2012-02-09 at 10:54.

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

    Re: Open C and Opening connection

    I am not planning to discuss to much about Open C networking, but
    - loopback (127.0.0.1) is local to the device, so an outgoing access point is not necessary
    - casting a string to uint32 (the commented part) does not exist, inet_addr is the function you are looking for.

  9. #9
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Open C and Opening connection

    struct sockaddr_in addr;
    int ip_sock =0;

    addr.sin_addr.s_addr = inet_addr("192.168.183.128");
    addr.sin_family = AF_INET;
    addr.sin_port = htons(80);
    if ((ip_sock = socket(AF_INET,SOCK_STREAM, IPPROTO_TCP)) < 0)
    {
    LOG("Couldn't create socket \n");
    return;
    }
    if (connect(ip_sock, (struct sockaddr *) &addr, sizeof(addr)) < 0)
    {
    LOG("Couldn't connect socket \n");
    return;
    }
    Tried this ... it ended up in the same section! LOG("Couldn't connect socket \n" .. and a kern exec 3 on emulator!
    Im happy if i can see that Ap list popup !!!,

  10. #10
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: Open C and Opening connection

    Replacing socket(AF_INET,SOCK_STREAM, IPPROTO_TCP) with socket(AF_INET,SOCK_STREAM, 0), as you tried in previous post but with different ip address. Try replacing it here again.

  11. #11
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Open C and Opening connection

    Finally mystery is over!! I tried the code on device i can see a 3g connection attempted but no accespoint pop up!! is it bcoz i have enuf capabilities? , But i need to specify accespoint at some point or ask to pop it when needed!! i was using symb 3 device

  12. #12
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: Open C and Opening connection

    May be in your device settings , you need to specify to ask the access point before making a request.

  13. #13
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Open C and Opening connection

    now I wonder
    how to procedd assuming that connection wll be fine
    I think I can write using sendto
    how will I read ?
    do I have to use any listen or bind or anything like that before reading on same socket ?
    or just call recvmsg () on the opened socket ?

    all I get is a kernexec 3!!
    Last edited by julie_777; 2012-02-10 at 08:50.

  14. #14
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Open C and Opening connection

    Hello,
    i couldn't find any specific complete example here on wiki, but you could take a look at the articles (only if you didn't yet!):
    http://www.developer.nokia.com/Commu...Open_C/C%2B%2B
    and search some linux examples with google, e.g. something like:
    http://www.tutorialspoint.com/unix_s...nt_example.htm
    or:
    http://www.linuxhowtos.org/C_C++/socket.htm

    hope it helps somehow
    regards
    pg

  15. #15
    Regular Contributor
    Join Date
    Nov 2004
    Location
    minsk
    Posts
    432

    Re: Open C and Opening connection

    Thanks a lot pavarang !! finally its doing some data transfer!! long way to go but atleast the journey has started!

Similar Threads

  1. Opening Web Browser on Open
    By carlm in forum Symbian
    Replies: 1
    Last Post: 2009-06-17, 01:31
  2. push opening with datagram wants to open wlan?
    By Shosio in forum Mobile Java General
    Replies: 0
    Last Post: 2008-05-05, 11:16
  3. Wap browser connection opening
    By Mauro_Nokia in forum Mobile Java General
    Replies: 0
    Last Post: 2006-06-05, 10:56
  4. Problem: opening a file with RFile::Open()
    By dermotkehoe in forum Symbian
    Replies: 7
    Last Post: 2006-02-09, 18:41
  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
  •  
×