×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    3

    Socket on loopback interface

    Dear all,
    I'm facing with a quite strange problem. My application is designed in this way : on the phone are running a midlet and a symbian application, the midlet acts as a server and the symbian application as a client. I used socket on loopback interface for any kind of communication.

    The problem is : what kind of IAP I've to choose for the loopback interface communication ?

    During the simulation everything is ok : when the communication starts, the carbide emulator asks me to select WINSOCKS IAP and all runs fine.

    But, what have I do when I run the application on the phone ? Is there any way to avoid the trigger the popup for IAP choise and use a "default" one ?

    Code snippet :

    Code:
                    ...        
    
                    RSocketServ ss;
    		TRequestStatus status;
    		RConnection conn;
    		
    		TInetAddr destAddr(KInetAddrLoop, 3993);
    
    		
    		ss.Connect();
    		
    		conn.Open(ss);
    		
    		conn.Start();
    		
    		// Open a Host Resolver associated with the connection
    		RHostResolver hr;
    		hr.Open(ss, KAfInet, KProtocolInetTcp, conn);
    		
    		// Open a Socket associated with the connection
    		RSocket iSocket;
    		iSocket.Open(ss, KAfInet, KSockStream, KProtocolInetTcp, conn);
    		
    		// Request the Socket to connect to the destination
    		iSocket.Connect(destAddr, status);
    		User::WaitForRequest(status);
    
                    ...
    Thank you in advance.
    Francesco

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

    Re: Socket on loopback interface

    RConnection::Start is the key, search for RConnection in the Wiki and you will get ideas. Technically there is a loopback interface too, if you manage to RConnection::Attach to it somehow, that may be even better - unfortunately I do not know if it is possible, have not tried in fact.

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    14

    Re: Socket on loopback interface

    Just use the socket API calls which do not use RConnection.
    Should work just fine.

  4. #4
    Super Contributor
    Join Date
    Jan 2008
    Location
    Amravati, India
    Posts
    546

    Re: Socket on loopback interface

    My Java MIDlet is listening on port 1234 and I am trying to connect to it from Symbian like this:
    PHP Code:
    TRequestStatus RequestStatus;
    User::LeaveIfError(SocketServ.Connect());
    User::LeaveIfError(Socket.Open(SocketServKAfInetKSockStreamKProtocolInetTcp));
    Socket.Connect(TInetAddr(KInetAddrLoop1234), RequestStatus);
    User::WaitForRequest(RequestStatus);
    if(
    RequestStatus != KErrNone){
       
    User::Leave(KErrGeneral);

    It works fine if no internet connection is active on phone. But when I start web browser (or any other software which uses internet) and put it to background, it doesn't work. I think the Symbian code is searching for address KInetAddrLoop (i.e. 127.0.0.1) on the internet. Please tell how to connect to a port on loop back interface even when an internet connection is active.

    Thanks

  5. #5
    Registered User
    Join Date
    Jan 2010
    Posts
    18

    Re: Socket on loopback interface

    Hi,

    i have implemented SimpleHttpServer using RSocket for connection between FlashLite 3.1. application. In the application, several images are loaded (with MovieClipLoader) from local http server which runs on 127.0.0.1 (KInetAddrLoop). Everything is working fine, but when i try to load images asynchronously, only first image is loaded and there is also only one request to local server. If i change IP adress to external interface (WLAN or modem, eg. 10.10.1.200), images are loaded properly.

    Anyone with some answers?

Similar Threads

  1. continuous read and write from tcp/ip socket
    By rahul.shalik.makode in forum Symbian
    Replies: 0
    Last Post: 2009-08-01, 08:17
  2. problem in persistant socket connection
    By poms4symbian in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-01-03, 13:23
  3. Socket problem
    By defragger in forum Symbian
    Replies: 0
    Last Post: 2005-08-25, 08:16

Posting Permissions

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