×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    KErrBadName in RSocket connection

    Hello,
    I have got the following problem.
    My application uses RSockets for communicating with server.
    I don t set default IAP, user is asked about it while starting connection.
    Ecerything seems to be working but...
    If user start my application and choose WAP access point socket is trying to connect and after some time i get KErrTimedOut what is normal action.
    The problem starts here.
    If i try to reconnect and i choose working IAP (i have used it before and use it in any other program and it works) just after RSocket call Connect immidietely i get KErrBadName error. If i switch off my application and switch it again it does not help and all the time i get KErrBadName.

    Parts of my code:
    Code:
    	iSocketServer.FindProtocol(KTCPText(),iProtocolInfo);// where KTCPText is tcp
    		Cancel();
    		TInetAddr iInetAddress(iNameEntry().iAddr);
    		iInetAddress.SetPort(iPort);
    		iInetAddress.SetFamily(iProtocolInfo.iAddrFamily);
    		if(isIapFound)//it s set EFalse
    			{
    		User::LeaveIfError(iSocket.Open(iSocketServer, iProtocolInfo.iAddrFamily ,iProtocolInfo.iSockType,
    				iProtocolInfo.iProtocol, iConnection) );
    			}
    		else
    			{
    			User::LeaveIfError(iSocket.Open(iSocketServer, iProtocolInfo.iAddrFamily ,iProtocolInfo.iSockType,
    					iProtocolInfo.iProtocol) );
    			}
    
    		iState = EConnectionStarted;
    		iSocket.Connect(iInetAddress, iStatus);
    		SetActive();
    after each time when i get Error while i m trying to connect i call StopCOnnection function:
    Code:
    ...
    	Cancel();
    	isHostResolved=EFalse;
    	iSocketServerConnected=EFalse;
    	iResolver.Close();
    	iSocket.Close();
    	iSocketServer.Close();
    ...
    My observations:
    -while my application gets KErrBadName browser works without any problem
    -my guess is that there might be something wrong with iPort which i set. Is it possible that i m making something wrong and don t close something and communication on my port is blocked?

    ps. I remind that this code which i use works without any problem if you choose any proper access point like wifi or internet gprs

    Thanks in advance

    Nuker85

  2. #2
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: KErrBadName in RSocket connection

    There are many sockets examples available. I suggest you use them as a starting point. Also, keep in mind that using automatic variables with asynchronous calls is recipe for disaster.

  3. #3
    Registered User
    Join Date
    May 2007
    Location
    Poland
    Posts
    606

    Re: KErrBadName in RSocket connection

    thanks for being interested in my post,
    keep in mind that using automatic variables with asynchronous calls is recipe for disaste
    yes, you are completely right. I have changed thoes variables to global but it was not my problem.

    After some time spent on my code, application and log thoes are things which i have figured out.

    Each time when i was resolving my iServerAddress in TNameEntry i received resolved addres of Family 2048 which represents v4 address family

    But after using WAP access point recolver has started returning TNameEntry of Family 2054 which represents v6 address family.

    That is why my application started returning KErrBadName because syntax of this family address is different than my socket expected.

    Here starts my questions:

    I m resolving in address in this way:
    Code:
    	TInt res;
    	if (isIapFound)
    		{
    		res = iResolver.Open(iSocketServer, KAfInet, KProtocolInetTcp,
    				iConnection);
    		}
    	else
    		{
    		res = iResolver.Open(iSocketServer, KAfInet, KProtocolInetTcp);
    		}
    			TBuf8<128> iAddress3;
    			iAddress3.Copy(_L8("https://"));
    			iAddress3.Append(iServerAddress);
    			TUriParser8 url;
    			url.Parse(iAddress3);
    			iAddress2.Zero();
    			iAddress2.Copy(url.Extract(EUriHost));
    			iNameEntry.Zero();
    			iState = EResolvingName;
    			iResolver.GetByName(iAddress2, iNameEntry, iStatus);
    			SetActive();
    if connection using this iNameEntry fails i try to iResolver.Next(iNameEntry, iStatus);

    1 )My question is how it is possible that my code if i use normal gprs access point i get in iNameEntry v4 familly and when i try to connect using WAP accesspoint any next attemp using normal gprs access point my resolver starts returning iNameEntry v6 familly? If i reboot mobile and try my application with normal gprs ap it works properly.

    It looks like using WAP accesspoint change something in device DNS

    2) is it possible to flush devices DNS ?

    While starting connection i m opening socket in the following way:

    Code:
    User::LeaveIfError(iSocket.Open(iSocketServer, iProtocolInfo.iAddrFamily ,iProtocolInfo.iSockType,
    					iProtocolInfo.iProtocol) );
    where iProtocolInfo i receive
    Code:
    _LIT(KTCPText,"tcp");
    iSocketServer.FindProtocol(KTCPText(),iProtocolInfo);
    While KTCPText is tcp for example iProtocolInfo.iAddrFamily is 2048 what represents v4 address family

    3) what should be my KTCPText to receive iProtocolInfo which will return me all the parameters needed for v6 address family connection?

    Thanks in advance
    Nuker85

Similar Threads

  1. Connection times out after 10 requests...
    By QSIPhone in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2007-04-09, 17:29
  2. Problem with connection timeout
    By maniac_2k in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-09-21, 20:12
  3. Http Connection
    By jaceline in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2006-06-09, 16:53
  4. MMS Interruption during GPRS connection hangs the device?
    By alexhong in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2004-08-31, 18:47
  5. MMS Interruption during GPRS connection hangs the device?
    By alexhong in forum Mobile Java General
    Replies: 0
    Last Post: 2004-08-31, 18:45

Posting Permissions

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