Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User zuii's Avatar
    Join Date
    Aug 2009
    Posts
    20
    I want to write a program based on UDP, and send something to anther phone(it runs an application and binded with the port i use),

    My problem is:
    1. if I don't have any wireless network, can I send successfully? Can it make a connection automatically when the application
    started?
    2. if there is a wireless network, am I must to choose an IAP first then send?
    3. I used RSocketServ and Rsocket to implement this program,didn't use RConnection,so there is no IAP choosing, Is this correct or not?

    can anybody know these issue? thanks~~

  2. #2
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    Yes, that is called "Ad-Hoc" WLAN, and it works well. As a first try, create it manually from the Settings application of the device. When creating a WLAN AP, you will see a field defaulting to "Infrastructure", that is the one you can change to "Ad-Hoc".
    Usage of an RConnection is highly recommended, otherwise every single SendTo will ask about the AP you want to use, and the server side is even worse, since RecvFrom does not requires any network interface to be powered up, just it will not receive anything.

  3. #3
    Registered User zuii's Avatar
    Join Date
    Aug 2009
    Posts
    20
    Thank you wizard_hu_,
    I can create AP with Ad-Hoc mode now,but I encountered another problem,if I want to connect to the other phone,the two phone need in the same WLAN,so I
    need set there SSID as the same, I want to ask how can I set the SSID? I didn't got the method or APIs from google or forum nokia...

  4. #4
    Registered User zuii's Avatar
    Join Date
    Aug 2009
    Posts
    20
    the SSID is the Network Name???

  5. #5
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    Yes, the SSID is referred as "WLAN network name" in the access point editor. Note that you can find examples for programmatic AP creation in the Wiki. Search for some combination of words create, wlan, access and point.

  6. #6
    Registered User zuii's Avatar
    Join Date
    Aug 2009
    Posts
    20
    Thanks,
    I have found a example days ago,and don't understand it clearly, the source code will be post latter. I wonder why define two CApAccessPointItem objects?
    After I have test and debug it for times, but no difference found,and it can create an AP successfully. So why use the second one?

    The code(I have modified it many times):
    Code:
    void CCreate::Create()
    	{
    	TInt errorCode;
    	
    	//CUtils::WriteLog(KLogName,_L("Starting create..."));
    	
    	CCommsDatabase* db = CCommsDatabase::NewL();
    	CleanupStack::PushL(db);
    	TInt err = db->BeginTransaction();
    
    	// Create a wlan AP and fill its mandatory fields.
    	CApAccessPointItem* wlanAp = CApAccessPointItem::NewLC();
    	//CApAccessPointItem* wlanNewItem = CApAccessPointItem::NewLC();//
    
    	wlanAp->SetNamesL(KApName);
    	wlanAp->SetBearerTypeL(EApBearerTypeWLAN);
    	wlanAp->WriteTextL(EApWlanNetworkName, KNetworkName); // Give corrct Data as per the router configuration  //L!nkSys@MdpNok!a
    
    	//Lan network mode should be 1 for infrastructure, 0 for adhoc
    	wlanAp->WriteUint(EApWlanNetworkMode, 0);
    	wlanAp->WriteUint(EApWlanChannelId, 3);
    
    	// Setting up advanced settings for IP addressing
    	wlanAp->WriteTextL(EApWlanIpAddr, KIPAddress);
    	wlanAp->WriteTextL(EApWlanIpNetMask, KIPMask);
    	wlanAp->WriteTextL(EApWlanIpGateway, KIPGatway);
    
    
    	
    	TBool val = ETrue;
    	TUint32 apid;
    	CApDataHandler* handler = CApDataHandler::NewLC(*db);
    	apid = handler->CreateFromDataL(*wlanAp);
    	handler->UpdateAccessPointDataL(*wlanAp, val);
    	//handler->AccessPointDataL(apid, *wlanNewItem); //copy AP data to wlanNewItem???
    
    	CApUtils *aputil = CApUtils::NewLC(*db);
    	TUint32 wapuid = wlanAp->WapUid(); //get the AP ID
    	TInt Iap = aputil->IapIdFromWapIdL(wapuid); //Get the Iap record ID for a given AP ID
    	
    	TUint32 newalanid;
    	wlanAp->ReadUint(EApIapServiceId, newalanid);
    	
    	//wlanNewItem->ReadUint(EApIapServiceId, newalanid);//
    	
    	TBuf<50> logBuf;
    	logBuf.AppendFormat(_L("ServiceID = %d"),newalanid);
    	CUtils::WriteLog(KLogName,logBuf);
    	
    	//TBuf<50> ibuff;//
    	//wlanNewItem->ReadTextL(EApWlanNetworkName, ibuff);//
    	//TUint32 newAPId = wlanNewItem->WapUid();//
    
    	CCommsDbTableView* wLanServiceTable = db->OpenViewMatchingUintLC(TPtrC(
    			WLAN_SERVICE), TPtrC(WLAN_SERVICE_ID), newalanid);
    
    	errorCode = wLanServiceTable->GotoFirstRecord();
    
    	if (errorCode == KErrNone)
    		{
    		wLanServiceTable->UpdateRecord();
    		}
    	else
    		{
    		TUint32 dummyUid(10); //KUidNone
    		User::LeaveIfError(wLanServiceTable->InsertRecord(dummyUid));
    		wLanServiceTable->WriteUintL(TPtrC(WLAN_SERVICE_ID), apid);
    		}
    
    	wLanServiceTable->PutRecordChanges();
    	err = db->CommitTransaction();
    
    	CleanupStack::PopAndDestroy(5);
    	}

Similar Threads

  1. PPC Bluetooth to Nokia phone serial connection
    By naahtec in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2007-07-27, 20:40
  2. [Pys60, 3rd Ed.] build problems
    By MHOOO in forum Python
    Replies: 3
    Last Post: 2007-04-09, 19:00
  3. Network demo with wireless toolkit wont work on phone
    By podge_boy in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-03-22, 19:12
  4. How to initiate a GPRS connection to the mobile phone from a remote server?
    By VigenIssahhanjan in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2004-11-22, 08:50
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved